[clang] [CIR][CUDA] Handle local, __device__, and __shared__ variables (PR #184248)

Andy Kaylor via cfe-commits cfe-commits at lists.llvm.org
Wed Mar 4 13:48:49 PST 2026


================
@@ -797,6 +797,22 @@ CIRGenModule::getOrCreateCIRGlobal(StringRef mangledName, mlir::Type ty,
                "external const declaration with initializer");
   }
 
+  // TODO(cir): if this method is used to handle functions we must have
+  // something closer to GlobalValue::isDeclaration instead of checking for
+  // initializer.
+  if (gv.isDeclaration()) {
+    // TODO(cir): set target attributes
+
+    // External HIP managed variables needed to be recorded for transformation
+    // in both device and host compilations.
+    // External HIP managed variables needed to be recorded for transformation
+    // in both device and host compilations.
+    if (getLangOpts().CUDA && d && d->hasAttr<HIPManagedAttr>() &&
+        d->hasExternalStorage())
+      llvm_unreachable("NYI");
----------------
andykaylor wrote:

```suggestion
      errorNYI("HIP managed attribute");
```

https://github.com/llvm/llvm-project/pull/184248


More information about the cfe-commits mailing list