================
@@ -2074,6 +2075,22 @@ llvm::Value *CodeGenFunction::emitScalarConstant(
   return Constant.getValue();
 }
 
+static bool isInvariantLoad(CodeGenFunction &CGF, LangAS TypeAS,
+                            llvm::Value *Ptr) {
+  if (TypeAS == LangAS::opencl_constant)
+    return true;
+
+  // CUDA represents constant memory as a declaration attribute, so the
+  // expression type uses the default address space. Recover the storage
+  // address space from the underlying global after the address-space cast.
+  if (!CGF.getLangOpts().CUDAIsDevice)
+    return false;
+  const auto *GV =
+      llvm::dyn_cast<llvm::GlobalValue>(llvm::getUnderlyingObject(Ptr));
----------------
arsenm wrote:

This should not be using getUnderlyingObject, this should only be using AST 
information 

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

Reply via email to