[llvm] bf375c5 - SPIRV: Avoid using TargetMachine::createDataLayout in subtarget (#224014)

via llvm-commits llvm-commits at lists.llvm.org
Wed Sep 16 22:39:38 PDT 2026


Author: Matt Arsenault
Date: 2026-09-17T07:39:33+02:00
New Revision: bf375c54e9c4fafca5ceb84f261decb692dc57c9

URL: https://github.com/llvm/llvm-project/commit/bf375c54e9c4fafca5ceb84f261decb692dc57c9
DIFF: https://github.com/llvm/llvm-project/commit/bf375c54e9c4fafca5ceb84f261decb692dc57c9.diff

LOG: SPIRV: Avoid using TargetMachine::createDataLayout in subtarget (#224014)

Added: 
    

Modified: 
    llvm/lib/Target/SPIRV/SPIRVSubtarget.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Target/SPIRV/SPIRVSubtarget.cpp b/llvm/lib/Target/SPIRV/SPIRVSubtarget.cpp
index 5899f60360a11..1f50082890898 100644
--- a/llvm/lib/Target/SPIRV/SPIRVSubtarget.cpp
+++ b/llvm/lib/Target/SPIRV/SPIRVSubtarget.cpp
@@ -110,7 +110,12 @@ SPIRVSubtarget::SPIRVSubtarget(const Triple &TT, const std::string &CPU,
   initAvailableExtensions(Extensions);
   initAvailableExtInstSets();
 
-  GR = std::make_unique<SPIRVGlobalRegistry>(TM.createDataLayout());
+  // FIXME: The GlobalRegistry does not belong in the subtarget, see issue
+  // #223774. The DataLayout is a property of the module and in principle
+  // depends on program state. It just happens SPIRV currently doesn't use
+  // target-abi names.
+  GR = std::make_unique<SPIRVGlobalRegistry>(
+      DataLayout(TargetTriple.computeDataLayout()));
   CallLoweringInfo = std::make_unique<SPIRVCallLowering>(TLInfo, GR.get());
   InlineAsmInfo = std::make_unique<SPIRVInlineAsmLowering>(TLInfo);
   Legalizer = std::make_unique<SPIRVLegalizerInfo>(*this);


        


More information about the llvm-commits mailing list