================
@@ -1178,6 +1180,26 @@ getTargetIDSettingFromFeatureString(StringRef 
FeatureString) {
   llvm_unreachable("Malformed feature string");
 }
 
+std::optional<std::pair<StringRef, StringRef>>
+AMDGPUTargetID::parseTargetIDDirective(StringRef TargetIDDirective) {
+  // Extract the CPU+features from the target ID directive
+  // Format: "amdgcn-amd-amdhsa--gfx1010:xnack-:sramecc+"
+  // Split on '-' and take the last element
+  SmallVector<StringRef, 8> Parts;
+  TargetIDDirective.split(Parts, '-');
+
+  if (Parts.empty())
+    return std::nullopt;
+
+  // The CPU+features is the last element after splitting on '-'
+  StringRef CPUAndFeatures = Parts.back();
----------------
shiltian wrote:

Does this look right? For `amdgcn-amd-amdhsa--gfx1010:xnack-:sramecc+`, the 
last part is `:sramecc+`, no?

https://github.com/llvm/llvm-project/pull/204595
_______________________________________________
llvm-branch-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits

Reply via email to