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/Transforms/Utils/InlineFunction.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/Transforms/Utils/InlineFunction.cpp')
-rw-r--r-- | llvm/lib/Transforms/Utils/InlineFunction.cpp | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/llvm/lib/Transforms/Utils/InlineFunction.cpp b/llvm/lib/Transforms/Utils/InlineFunction.cpp index 39e3a2c..f2130e4 100644 --- a/llvm/lib/Transforms/Utils/InlineFunction.cpp +++ b/llvm/lib/Transforms/Utils/InlineFunction.cpp @@ -1575,7 +1575,7 @@ static void AddAlignmentAssumptions(CallBase &CB, InlineFunctionInfo &IFI) { return; AssumptionCache *AC = &IFI.GetAssumptionCache(*CB.getCaller()); - auto &DL = CB.getCaller()->getParent()->getDataLayout(); + auto &DL = CB.getDataLayout(); // To avoid inserting redundant assumptions, we should check for assumptions // already in the caller. To do this, we might need a DT of the caller. @@ -1638,7 +1638,7 @@ static Value *HandleByValArgument(Type *ByValType, Value *Arg, InlineFunctionInfo &IFI, MaybeAlign ByValAlignment) { Function *Caller = TheCall->getFunction(); - const DataLayout &DL = Caller->getParent()->getDataLayout(); + const DataLayout &DL = Caller->getDataLayout(); // If the called function is readonly, then it could not mutate the caller's // copy of the byval'd memory. In this case, it is safe to elide the copy and @@ -2293,7 +2293,7 @@ llvm::InlineResult llvm::InlineFunction(CallBase &CB, InlineFunctionInfo &IFI, // callee. ScopedAliasMetadataDeepCloner SAMetadataCloner(CB.getCalledFunction()); - auto &DL = Caller->getParent()->getDataLayout(); + auto &DL = Caller->getDataLayout(); // Calculate the vector of arguments to pass into the function cloner, which // matches up the formal to the actual argument values. @@ -2627,7 +2627,7 @@ llvm::InlineResult llvm::InlineFunction(CallBase &CB, InlineFunctionInfo &IFI, ConstantInt *AllocaSize = nullptr; if (ConstantInt *AIArraySize = dyn_cast<ConstantInt>(AI->getArraySize())) { - auto &DL = Caller->getParent()->getDataLayout(); + auto &DL = Caller->getDataLayout(); Type *AllocaType = AI->getAllocatedType(); TypeSize AllocaTypeSize = DL.getTypeAllocSize(AllocaType); uint64_t AllocaArraySize = AIArraySize->getLimitedValue(); @@ -3033,7 +3033,7 @@ llvm::InlineResult llvm::InlineFunction(CallBase &CB, InlineFunctionInfo &IFI, if (PHI) { AssumptionCache *AC = IFI.GetAssumptionCache ? &IFI.GetAssumptionCache(*Caller) : nullptr; - auto &DL = Caller->getParent()->getDataLayout(); + auto &DL = Caller->getDataLayout(); if (Value *V = simplifyInstruction(PHI, {DL, nullptr, nullptr, AC})) { PHI->replaceAllUsesWith(V); PHI->eraseFromParent(); |