[TargetParser] Simplify getArchFamilyNameAMDGCN. NFC.#186122
Merged
[TargetParser] Simplify getArchFamilyNameAMDGCN. NFC.#186122
Conversation
Member
|
@llvm/pr-subscribers-backend-amdgpu Author: Jay Foad (jayfoad) ChangesFull diff: https://github.com/llvm/llvm-project/pull/186122.diff 1 Files Affected:
diff --git a/llvm/lib/TargetParser/TargetParser.cpp b/llvm/lib/TargetParser/TargetParser.cpp
index 3dcd0e9990021..c5c2fb6b70e09 100644
--- a/llvm/lib/TargetParser/TargetParser.cpp
+++ b/llvm/lib/TargetParser/TargetParser.cpp
@@ -205,23 +205,12 @@ const GPUInfo *getArchEntry(AMDGPU::GPUKind AK, ArrayRef<GPUInfo> Table) {
} // namespace
StringRef llvm::AMDGPU::getArchFamilyNameAMDGCN(GPUKind AK) {
- switch (AK) {
- case AMDGPU::GK_GFX9_GENERIC:
- case AMDGPU::GK_GFX9_4_GENERIC:
- return "gfx9";
- case AMDGPU::GK_GFX10_1_GENERIC:
- case AMDGPU::GK_GFX10_3_GENERIC:
- return "gfx10";
- case AMDGPU::GK_GFX11_GENERIC:
- return "gfx11";
- case AMDGPU::GK_GFX12_GENERIC:
- case AMDGPU::GK_GFX12_5_GENERIC:
- return "gfx12";
- default: {
- StringRef ArchName = getArchNameAMDGCN(AK);
- return ArchName.empty() ? "" : ArchName.drop_back(2);
- }
+ StringRef ArchName = getArchNameAMDGCN(AK);
+ if (ArchName.ends_with("-generic")) {
+ // Return the part before the first '-', e.g. "gfx9-4-generic" -> "gfx9".
+ return ArchName.take_front(ArchName.find('-'));
}
+ return ArchName.empty() ? "" : ArchName.drop_back(2);
}
StringRef llvm::AMDGPU::getArchNameAMDGCN(GPUKind AK) {
|
🐧 Linux x64 Test Results
Failed Tests(click on a test name to see its output) lldb-apilldb-api.functionalities/data-formatter/data-formatter-stl/generic/list/TestDataFormatterGenericList.pyIf these failures are unrelated to your changes (for example tests are broken or flaky at HEAD), please open an issue at https://github.com/llvm/llvm-project/issues and add the |
shiltian
approved these changes
Mar 12, 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.
No description provided.