[clang] [llvm] [NVPTX] Change the alloca address space in NVPTXLowerAlloca (PR #154814)

Theodoros Theodoridis via llvm-commits llvm-commits at lists.llvm.org
Wed Sep 3 06:00:58 PDT 2025


================
@@ -1444,15 +1444,16 @@ void clang::emitBackendOutput(CompilerInstance &CI, CodeGenOptions &CGOpts,
 
   // Verify clang's TargetInfo DataLayout against the LLVM TargetMachine's
   // DataLayout.
-  if (AsmHelper.TM) {
-    std::string DLDesc = M->getDataLayout().getStringRepresentation();
-    if (DLDesc != TDesc) {
+  if (AsmHelper.TM)
+    if (!AsmHelper.TM->isCompatibleDataLayout(M->getDataLayout()) ||
+        !AsmHelper.TM->isCompatibleDataLayout(DataLayout(TDesc))) {
+      std::string DLDesc = M->getDataLayout().getStringRepresentation();
----------------
thetheodor wrote:

> Perhaps a better approach would be to keep things simple, keep DL as is,
I removed the DL change.

>  and just change InferAddressSpace to rewrite those allocas to alloca addrspace(5) + ASC to generic AS instead of the current double ASC.

I guess you meant `NVPTXLowerAlloca` instead of `InferAddressSpace`, or am I missing something? 



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


More information about the llvm-commits mailing list