[llvm] a446300 - TargetLowering: Avoid a use of PointerType::getUnqual (#147884)

via llvm-commits llvm-commits at lists.llvm.org
Thu Jul 10 03:01:03 PDT 2025


Author: Matt Arsenault
Date: 2025-07-10T19:00:59+09:00
New Revision: a446300d1bd0b97b400b2f246f1aa861d62115e6

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

LOG: TargetLowering: Avoid a use of PointerType::getUnqual (#147884)

Use the default globals address space

Added: 
    

Modified: 
    llvm/lib/CodeGen/TargetLoweringBase.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/CodeGen/TargetLoweringBase.cpp b/llvm/lib/CodeGen/TargetLoweringBase.cpp
index 0a077b7b61437..6feeb19bb8589 100644
--- a/llvm/lib/CodeGen/TargetLoweringBase.cpp
+++ b/llvm/lib/CodeGen/TargetLoweringBase.cpp
@@ -2031,7 +2031,9 @@ bool TargetLoweringBase::isLegalAddressingMode(const DataLayout &DL,
 Value *TargetLoweringBase::getIRStackGuard(IRBuilderBase &IRB) const {
   if (getTargetMachine().getTargetTriple().isOSOpenBSD()) {
     Module &M = *IRB.GetInsertBlock()->getParent()->getParent();
-    PointerType *PtrTy = PointerType::getUnqual(M.getContext());
+    const DataLayout &DL = M.getDataLayout();
+    PointerType *PtrTy =
+        PointerType::get(M.getContext(), DL.getDefaultGlobalsAddressSpace());
     GlobalVariable *G = M.getOrInsertGlobal("__guard_local", PtrTy);
     G->setVisibility(GlobalValue::HiddenVisibility);
     return G;


        


More information about the llvm-commits mailing list