aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/CodeGen/TargetLoweringBase.cpp
diff options
context:
space:
mode:
authorPeter Collingbourne <peter@pcc.me.uk>2025-05-27 12:23:12 -0700
committerGitHub <noreply@github.com>2025-05-27 12:23:12 -0700
commit645f0e6723f21aef8099d8d65f5719fd9feb125e (patch)
treef39b5cfe6a4d9c59ab7cd07c77943ae2c4275c12 /llvm/lib/CodeGen/TargetLoweringBase.cpp
parentea8838446678a1163b361b0598b1259e9f476900 (diff)
downloadllvm-645f0e6723f21aef8099d8d65f5719fd9feb125e.zip
llvm-645f0e6723f21aef8099d8d65f5719fd9feb125e.tar.gz
llvm-645f0e6723f21aef8099d8d65f5719fd9feb125e.tar.bz2
IR: Make Module::getOrInsertGlobal() return a GlobalVariable.
After pointer element types were removed this function can only return a GlobalVariable, so reflect that in the type and comments and clean up callers. Reviewers: nikic Reviewed By: nikic Pull Request: https://github.com/llvm/llvm-project/pull/141323
Diffstat (limited to 'llvm/lib/CodeGen/TargetLoweringBase.cpp')
-rw-r--r--llvm/lib/CodeGen/TargetLoweringBase.cpp7
1 files changed, 3 insertions, 4 deletions
diff --git a/llvm/lib/CodeGen/TargetLoweringBase.cpp b/llvm/lib/CodeGen/TargetLoweringBase.cpp
index c85f0c7..935afaf 100644
--- a/llvm/lib/CodeGen/TargetLoweringBase.cpp
+++ b/llvm/lib/CodeGen/TargetLoweringBase.cpp
@@ -1975,10 +1975,9 @@ Value *TargetLoweringBase::getIRStackGuard(IRBuilderBase &IRB) const {
if (getTargetMachine().getTargetTriple().isOSOpenBSD()) {
Module &M = *IRB.GetInsertBlock()->getParent()->getParent();
PointerType *PtrTy = PointerType::getUnqual(M.getContext());
- Constant *C = M.getOrInsertGlobal("__guard_local", PtrTy);
- if (GlobalVariable *G = dyn_cast_or_null<GlobalVariable>(C))
- G->setVisibility(GlobalValue::HiddenVisibility);
- return C;
+ GlobalVariable *G = M.getOrInsertGlobal("__guard_local", PtrTy);
+ G->setVisibility(GlobalValue::HiddenVisibility);
+ return G;
}
return nullptr;
}