aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/CodeGen/CodeGenPrepare.cpp
diff options
context:
space:
mode:
authorNikita Popov <npopov@redhat.com>2024-06-28 08:36:49 +0200
committerGitHub <noreply@github.com>2024-06-28 08:36:49 +0200
commit9df71d7673b5c98e1032d01be83724a45b42fafc (patch)
treecf5f0c837110b4a753e71b0532d8e5ee6d487411 /llvm/lib/CodeGen/CodeGenPrepare.cpp
parent519e0bb094bd9444b64ac62f2e8192543fdb94b9 (diff)
downloadllvm-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/CodeGen/CodeGenPrepare.cpp')
-rw-r--r--llvm/lib/CodeGen/CodeGenPrepare.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/llvm/lib/CodeGen/CodeGenPrepare.cpp b/llvm/lib/CodeGen/CodeGenPrepare.cpp
index 02cbf01..5a7d8a5 100644
--- a/llvm/lib/CodeGen/CodeGenPrepare.cpp
+++ b/llvm/lib/CodeGen/CodeGenPrepare.cpp
@@ -509,7 +509,7 @@ bool CodeGenPrepareLegacyPass::runOnFunction(Function &F) {
return false;
auto TM = &getAnalysis<TargetPassConfig>().getTM<TargetMachine>();
CodeGenPrepare CGP(TM);
- CGP.DL = &F.getParent()->getDataLayout();
+ CGP.DL = &F.getDataLayout();
CGP.SubtargetInfo = TM->getSubtargetImpl(F);
CGP.TLI = CGP.SubtargetInfo->getTargetLowering();
CGP.TRI = CGP.SubtargetInfo->getRegisterInfo();
@@ -557,7 +557,7 @@ PreservedAnalyses CodeGenPreparePass::run(Function &F,
}
bool CodeGenPrepare::run(Function &F, FunctionAnalysisManager &AM) {
- DL = &F.getParent()->getDataLayout();
+ DL = &F.getDataLayout();
SubtargetInfo = TM->getSubtargetImpl(F);
TLI = SubtargetInfo->getTargetLowering();
TRI = SubtargetInfo->getRegisterInfo();
@@ -5185,7 +5185,7 @@ static bool IsOperandAMemoryOperand(CallInst *CI, InlineAsm *IA, Value *OpVal,
const TargetRegisterInfo &TRI) {
const Function *F = CI->getFunction();
TargetLowering::AsmOperandInfoVector TargetConstraints =
- TLI.ParseConstraints(F->getParent()->getDataLayout(), &TRI, *CI);
+ TLI.ParseConstraints(F->getDataLayout(), &TRI, *CI);
for (TargetLowering::AsmOperandInfo &OpInfo : TargetConstraints) {
// Compute the constraint code and ConstraintType to use.