diff options
author | Nikita Popov <npopov@redhat.com> | 2024-06-28 08:36:49 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-06-28 08:36:49 +0200 |
commit | 9df71d7673b5c98e1032d01be83724a45b42fafc (patch) | |
tree | cf5f0c837110b4a753e71b0532d8e5ee6d487411 /llvm/lib/Target/TargetMachine.cpp | |
parent | 519e0bb094bd9444b64ac62f2e8192543fdb94b9 (diff) | |
download | llvm-9df71d7673b5c98e1032d01be83724a45b42fafc.zip llvm-9df71d7673b5c98e1032d01be83724a45b42fafc.tar.gz llvm-9df71d7673b5c98e1032d01be83724a45b42fafc.tar.bz2 |
[IR] Add getDataLayout() helpers to Function and GlobalValue (#96919)
Similar to https://github.com/llvm/llvm-project/pull/96902, this adds
`getDataLayout()` helpers to Function and GlobalValue, replacing the
current `getParent()->getDataLayout()` pattern.
Diffstat (limited to 'llvm/lib/Target/TargetMachine.cpp')
-rw-r--r-- | llvm/lib/Target/TargetMachine.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/llvm/lib/Target/TargetMachine.cpp b/llvm/lib/Target/TargetMachine.cpp index 8ddc742..eab9bc95 100644 --- a/llvm/lib/Target/TargetMachine.cpp +++ b/llvm/lib/Target/TargetMachine.cpp @@ -105,7 +105,7 @@ bool TargetMachine::isLargeGlobalValue(const GlobalValue *GVal) const { GV->getName().starts_with("__start_") || GV->getName().starts_with("__stop_"))) return true; - const DataLayout &DL = GV->getParent()->getDataLayout(); + const DataLayout &DL = GV->getDataLayout(); uint64_t Size = DL.getTypeAllocSize(GV->getValueType()); return Size == 0 || Size > LargeDataThreshold; } @@ -268,7 +268,7 @@ void TargetMachine::setOptLevel(CodeGenOptLevel Level) { OptLevel = Level; } TargetTransformInfo TargetMachine::getTargetTransformInfo(const Function &F) const { - return TargetTransformInfo(F.getParent()->getDataLayout()); + return TargetTransformInfo(F.getDataLayout()); } void TargetMachine::getNameWithPrefix(SmallVectorImpl<char> &Name, |