aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Transforms/IPO/WholeProgramDevirt.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/Transforms/IPO/WholeProgramDevirt.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/Transforms/IPO/WholeProgramDevirt.cpp')
-rw-r--r--llvm/lib/Transforms/IPO/WholeProgramDevirt.cpp8
1 files changed, 3 insertions, 5 deletions
diff --git a/llvm/lib/Transforms/IPO/WholeProgramDevirt.cpp b/llvm/lib/Transforms/IPO/WholeProgramDevirt.cpp
index aa527ae..3a25255 100644
--- a/llvm/lib/Transforms/IPO/WholeProgramDevirt.cpp
+++ b/llvm/lib/Transforms/IPO/WholeProgramDevirt.cpp
@@ -1689,12 +1689,10 @@ void DevirtModule::exportConstant(VTableSlot Slot, ArrayRef<uint64_t> Args,
Constant *DevirtModule::importGlobal(VTableSlot Slot, ArrayRef<uint64_t> Args,
StringRef Name) {
- Constant *C =
+ GlobalVariable *GV =
M.getOrInsertGlobal(getGlobalName(Slot, Args, Name), Int8Arr0Ty);
- auto *GV = dyn_cast<GlobalVariable>(C);
- if (GV)
- GV->setVisibility(GlobalValue::HiddenVisibility);
- return C;
+ GV->setVisibility(GlobalValue::HiddenVisibility);
+ return GV;
}
Constant *DevirtModule::importConstant(VTableSlot Slot, ArrayRef<uint64_t> Args,