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

Matt Arsenault via llvm-commits llvm-commits at lists.llvm.org
Wed Jul 9 21:20:24 PDT 2025


https://github.com/arsenm created https://github.com/llvm/llvm-project/pull/147884

Use the default globals address space

>From 9d4f557810c3afb6ebe0acfde47965ddc0858675 Mon Sep 17 00:00:00 2001
From: Matt Arsenault <Matthew.Arsenault at amd.com>
Date: Thu, 10 Jul 2025 13:18:47 +0900
Subject: [PATCH] TargetLowering: Avoid a use of PointerType::getUnqual

Use the default globals address space
---
 llvm/lib/CodeGen/TargetLoweringBase.cpp | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/llvm/lib/CodeGen/TargetLoweringBase.cpp b/llvm/lib/CodeGen/TargetLoweringBase.cpp
index 85b148a466e52..763bdb8b2a26f 100644
--- a/llvm/lib/CodeGen/TargetLoweringBase.cpp
+++ b/llvm/lib/CodeGen/TargetLoweringBase.cpp
@@ -1991,7 +1991,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