================
@@ -2964,20 +2963,36 @@ static bool isValidCodeModelAttr(Sema &S, StringRef 
Str) {
 static void handleCodeModelAttr(Sema &S, Decl *D, const ParsedAttr &AL) {
   StringRef Str;
   SourceLocation LiteralLoc;
+  auto IsTripleSupported = [](const llvm::Triple Triple) {
+    return Triple.getArch() == llvm::Triple::ArchType::x86_64 ||
+           Triple.isLoongArch();
+  };
+
   // Check that it is a string.
   if (!S.checkStringLiteralArgumentAttr(AL, 0, Str, &LiteralLoc))
     return;
 
-  // Ignore the attribute for GPU device compiles since it only applies to host
-  // globals.
-  if (S.Context.getTargetInfo().getTriple().isNVPTX() ||
-      S.Context.getTargetInfo().getTriple().isAMDGPU() ||
-      S.Context.getTargetInfo().getTriple().isSPIRV())
+  SmallVector<llvm::Triple, 2> Triples = {
+      S.Context.getTargetInfo().getTriple()};
+  if (auto *aux = S.Context.getAuxTargetInfo()) {
+    Triples.push_back(aux->getTriple());
+  } else if (S.Context.getTargetInfo().getTriple().isNVPTX() ||
----------------
rnk wrote:

This is not actionable in this patch, but this points to the need for some kind 
of `isGPU` / `isVirtualISA` predicate.

https://github.com/llvm/llvm-project/pull/124834
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to