aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Transforms/Utils/Local.cpp
diff options
context:
space:
mode:
authorEli Friedman <efriedma@quicinc.com>2025-06-09 13:51:03 -0700
committerGitHub <noreply@github.com>2025-06-09 13:51:03 -0700
commit9f82ac5738fced23716ac6f9c5744f99d6b6ba92 (patch)
tree7b73b889458d262ca48740245748607971852365 /llvm/lib/Transforms/Utils/Local.cpp
parentf9b98e386ed2b2e2885b9e6dffceb1c915c282b8 (diff)
downloadllvm-9f82ac5738fced23716ac6f9c5744f99d6b6ba92.zip
llvm-9f82ac5738fced23716ac6f9c5744f99d6b6ba92.tar.gz
llvm-9f82ac5738fced23716ac6f9c5744f99d6b6ba92.tar.bz2
Remove GlobalObject::getAlign/setAlignment (#143188)
Currently, GlobalObject has an "alignment" property... but it's basically nonsense: alignment doesn't mean the same thing for variables and functions, and it's completely meaningless for ifuncs. This "removes" (actually marking protected) the methods from GlobalObject, adds the relevant methods to Function and GlobalVariable, and adjusts the code appropriately. This should make future alignment-related cleanups easier.
Diffstat (limited to 'llvm/lib/Transforms/Utils/Local.cpp')
-rw-r--r--llvm/lib/Transforms/Utils/Local.cpp12
1 files changed, 6 insertions, 6 deletions
diff --git a/llvm/lib/Transforms/Utils/Local.cpp b/llvm/lib/Transforms/Utils/Local.cpp
index c8ad01a..0184a1e 100644
--- a/llvm/lib/Transforms/Utils/Local.cpp
+++ b/llvm/lib/Transforms/Utils/Local.cpp
@@ -1546,9 +1546,9 @@ Align llvm::tryEnforceAlignment(Value *V, Align PrefAlign,
return PrefAlign;
}
- if (auto *GO = dyn_cast<GlobalObject>(V)) {
+ if (auto *GV = dyn_cast<GlobalVariable>(V)) {
// TODO: as above, this shouldn't be necessary.
- Align CurrentAlign = GO->getPointerAlignment(DL);
+ Align CurrentAlign = GV->getPointerAlignment(DL);
if (PrefAlign <= CurrentAlign)
return CurrentAlign;
@@ -1556,16 +1556,16 @@ Align llvm::tryEnforceAlignment(Value *V, Align PrefAlign,
// of the global. If the memory we set aside for the global may not be the
// memory used by the final program then it is impossible for us to reliably
// enforce the preferred alignment.
- if (!GO->canIncreaseAlignment())
+ if (!GV->canIncreaseAlignment())
return CurrentAlign;
- if (GO->isThreadLocal()) {
- unsigned MaxTLSAlign = GO->getParent()->getMaxTLSAlignment() / CHAR_BIT;
+ if (GV->isThreadLocal()) {
+ unsigned MaxTLSAlign = GV->getParent()->getMaxTLSAlignment() / CHAR_BIT;
if (MaxTLSAlign && PrefAlign > Align(MaxTLSAlign))
PrefAlign = Align(MaxTLSAlign);
}
- GO->setAlignment(PrefAlign);
+ GV->setAlignment(PrefAlign);
return PrefAlign;
}