clang/AMDGPU: Remove StringSwitch over r600 aliases#209256
Merged
arsenm merged 1 commit intoJul 13, 2026
Merged
Conversation
This will route to getArchNameR600 which should already handle all the aliases.
|
@llvm/pr-subscribers-clang @llvm/pr-subscribers-backend-amdgpu Author: Matt Arsenault (arsenm) ChangesThis will route to getArchNameR600 which should already handle Full diff: https://github.com/llvm/llvm-project/pull/209256.diff 1 Files Affected:
diff --git a/clang/lib/Driver/ToolChains/CommonArgs.cpp b/clang/lib/Driver/ToolChains/CommonArgs.cpp
index 2bfa1fbb1c678..08c06951cf220 100644
--- a/clang/lib/Driver/ToolChains/CommonArgs.cpp
+++ b/clang/lib/Driver/ToolChains/CommonArgs.cpp
@@ -697,19 +697,10 @@ void tools::AddTargetFeature(const ArgList &Args,
}
/// Get the (LLVM) name of the AMDGPU gpu we are targeting.
-static std::string getAMDGPUTargetGPU(const llvm::Triple &T,
- const ArgList &Args) {
+static StringRef getAMDGPUTargetGPU(const llvm::Triple &T,
+ const ArgList &Args) {
if (Arg *A = Args.getLastArg(options::OPT_mcpu_EQ)) {
- auto GPUName = getProcessorFromTargetID(T, A->getValue());
- return llvm::StringSwitch<std::string>(GPUName)
- .Cases({"rv630", "rv635"}, "r600")
- .Cases({"rv610", "rv620", "rs780"}, "rs880")
- .Case("rv740", "rv770")
- .Case("palm", "cedar")
- .Cases({"sumo", "sumo2"}, "sumo")
- .Case("hemlock", "cypress")
- .Case("aruba", "cayman")
- .Default(GPUName.str());
+ return getProcessorFromTargetID(T, A->getValue());
}
return "";
}
@@ -835,7 +826,7 @@ std::string tools::getCPUName(const Driver &D, const ArgList &Args,
case llvm::Triple::amdgpu:
case llvm::Triple::r600:
- return getAMDGPUTargetGPU(T, Args);
+ return getAMDGPUTargetGPU(T, Args).str();
case llvm::Triple::wasm32:
case llvm::Triple::wasm64:
|
slinder1
approved these changes
Jul 13, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

This will route to getArchNameR600 which should already handle
all the aliases.