Skip to content

Commit 9df71d7

Browse files
authored
[IR] Add getDataLayout() helpers to Function and GlobalValue (#96919)
Similar to #96902, this adds `getDataLayout()` helpers to Function and GlobalValue, replacing the current `getParent()->getDataLayout()` pattern.
1 parent 519e0bb commit 9df71d7

File tree

178 files changed

+313
-293
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

178 files changed

+313
-293
lines changed

llvm/include/llvm/Analysis/ScalarEvolution.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1266,7 +1266,7 @@ class ScalarEvolution {
12661266
/// Return the DataLayout associated with the module this SCEV instance is
12671267
/// operating on.
12681268
const DataLayout &getDataLayout() const {
1269-
return F.getParent()->getDataLayout();
1269+
return F.getDataLayout();
12701270
}
12711271

12721272
const SCEVPredicate *getEqualPredicate(const SCEV *LHS, const SCEV *RHS);

llvm/include/llvm/CodeGen/GlobalISel/MachineIRBuilder.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -284,7 +284,7 @@ class MachineIRBuilder {
284284
}
285285

286286
const DataLayout &getDataLayout() const {
287-
return getMF().getFunction().getParent()->getDataLayout();
287+
return getMF().getFunction().getDataLayout();
288288
}
289289

290290
LLVMContext &getContext() const {

llvm/include/llvm/IR/Function.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ typedef unsigned ID;
4747
class AssemblyAnnotationWriter;
4848
class Constant;
4949
class ConstantRange;
50+
class DataLayout;
5051
struct DenormalMode;
5152
class DISubprogram;
5253
enum LibFunc : unsigned;
@@ -214,6 +215,11 @@ class LLVM_EXTERNAL_VISIBILITY Function : public GlobalObject,
214215
/// function.
215216
LLVMContext &getContext() const;
216217

218+
/// Get the data layout of the module this function belongs to.
219+
///
220+
/// Requires the function to have a parent module.
221+
const DataLayout &getDataLayout() const;
222+
217223
/// isVarArg - Return true if this function takes a variable number of
218224
/// arguments.
219225
bool isVarArg() const { return getFunctionType()->isVarArg(); }

llvm/include/llvm/IR/GlobalValue.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ namespace llvm {
3232

3333
class Comdat;
3434
class ConstantRange;
35+
class DataLayout;
3536
class Error;
3637
class GlobalObject;
3738
class Module;
@@ -655,6 +656,11 @@ class GlobalValue : public Constant {
655656
Module *getParent() { return Parent; }
656657
const Module *getParent() const { return Parent; }
657658

659+
/// Get the data layout of the module this global belongs to.
660+
///
661+
/// Requires the global to have a parent module.
662+
const DataLayout &getDataLayout() const;
663+
658664
// Methods for support type inquiry through isa, cast, and dyn_cast:
659665
static bool classof(const Value *V) {
660666
return V->getValueID() == Value::FunctionVal ||

llvm/lib/Analysis/AliasAnalysisEvaluator.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ PreservedAnalyses AAEvaluator::run(Function &F, FunctionAnalysisManager &AM) {
9999
}
100100

101101
void AAEvaluator::runInternal(Function &F, AAResults &AA) {
102-
const DataLayout &DL = F.getParent()->getDataLayout();
102+
const DataLayout &DL = F.getDataLayout();
103103

104104
++FunctionCount;
105105

llvm/lib/Analysis/BasicAliasAnalysis.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1919,7 +1919,7 @@ BasicAAResult BasicAA::run(Function &F, FunctionAnalysisManager &AM) {
19191919
auto &TLI = AM.getResult<TargetLibraryAnalysis>(F);
19201920
auto &AC = AM.getResult<AssumptionAnalysis>(F);
19211921
auto *DT = &AM.getResult<DominatorTreeAnalysis>(F);
1922-
return BasicAAResult(F.getParent()->getDataLayout(), F, TLI, AC, DT);
1922+
return BasicAAResult(F.getDataLayout(), F, TLI, AC, DT);
19231923
}
19241924

19251925
BasicAAWrapperPass::BasicAAWrapperPass() : FunctionPass(ID) {
@@ -1947,7 +1947,7 @@ bool BasicAAWrapperPass::runOnFunction(Function &F) {
19471947
auto &TLIWP = getAnalysis<TargetLibraryInfoWrapperPass>();
19481948
auto &DTWP = getAnalysis<DominatorTreeWrapperPass>();
19491949

1950-
Result.reset(new BasicAAResult(F.getParent()->getDataLayout(), F,
1950+
Result.reset(new BasicAAResult(F.getDataLayout(), F,
19511951
TLIWP.getTLI(F), ACT.getAssumptionCache(F),
19521952
&DTWP.getDomTree()));
19531953

llvm/lib/Analysis/ConstantFolding.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -644,7 +644,7 @@ Constant *llvm::ReadByteArrayFromGlobal(const GlobalVariable *GV,
644644
if (!GV->isConstant() || !GV->hasDefinitiveInitializer())
645645
return nullptr;
646646

647-
const DataLayout &DL = GV->getParent()->getDataLayout();
647+
const DataLayout &DL = GV->getDataLayout();
648648
Constant *Init = const_cast<Constant *>(GV->getInitializer());
649649
TypeSize InitSize = DL.getTypeAllocSize(Init->getType());
650650
if (InitSize < Offset)
@@ -3485,15 +3485,15 @@ Constant *llvm::ConstantFoldCall(const CallBase *Call, Function *F,
34853485
StringRef Name = F->getName();
34863486
if (auto *FVTy = dyn_cast<FixedVectorType>(Ty))
34873487
return ConstantFoldFixedVectorCall(
3488-
Name, IID, FVTy, Operands, F->getParent()->getDataLayout(), TLI, Call);
3488+
Name, IID, FVTy, Operands, F->getDataLayout(), TLI, Call);
34893489

34903490
if (auto *SVTy = dyn_cast<ScalableVectorType>(Ty))
34913491
return ConstantFoldScalableVectorCall(
3492-
Name, IID, SVTy, Operands, F->getParent()->getDataLayout(), TLI, Call);
3492+
Name, IID, SVTy, Operands, F->getDataLayout(), TLI, Call);
34933493

34943494
if (auto *StTy = dyn_cast<StructType>(Ty))
34953495
return ConstantFoldStructCall(Name, IID, StTy, Operands,
3496-
F->getParent()->getDataLayout(), TLI, Call);
3496+
F->getDataLayout(), TLI, Call);
34973497

34983498
// TODO: If this is a library function, we already discovered that above,
34993499
// so we should pass the LibFunc, not the name (and it might be better

llvm/lib/Analysis/DependenceAnalysis.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3607,7 +3607,7 @@ DependenceInfo::depends(Instruction *Src, Instruction *Dst,
36073607
Value *SrcPtr = getLoadStorePointerOperand(Src);
36083608
Value *DstPtr = getLoadStorePointerOperand(Dst);
36093609

3610-
switch (underlyingObjectsAlias(AA, F->getParent()->getDataLayout(),
3610+
switch (underlyingObjectsAlias(AA, F->getDataLayout(),
36113611
MemoryLocation::get(Dst),
36123612
MemoryLocation::get(Src))) {
36133613
case AliasResult::MayAlias:
@@ -4034,7 +4034,7 @@ const SCEV *DependenceInfo::getSplitIteration(const Dependence &Dep,
40344034
Value *SrcPtr = getLoadStorePointerOperand(Src);
40354035
Value *DstPtr = getLoadStorePointerOperand(Dst);
40364036
assert(underlyingObjectsAlias(
4037-
AA, F->getParent()->getDataLayout(), MemoryLocation::get(Dst),
4037+
AA, F->getDataLayout(), MemoryLocation::get(Dst),
40384038
MemoryLocation::get(Src)) == AliasResult::MustAlias);
40394039

40404040
// establish loop nesting levels

llvm/lib/Analysis/InlineCost.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -498,7 +498,7 @@ class CallAnalyzer : public InstVisitor<CallAnalyzer, bool> {
498498
ProfileSummaryInfo *PSI = nullptr,
499499
OptimizationRemarkEmitter *ORE = nullptr)
500500
: TTI(TTI), GetAssumptionCache(GetAssumptionCache), GetBFI(GetBFI),
501-
PSI(PSI), F(Callee), DL(F.getParent()->getDataLayout()), ORE(ORE),
501+
PSI(PSI), F(Callee), DL(F.getDataLayout()), ORE(ORE),
502502
CandidateCall(Call) {}
503503

504504
InlineResult analyze();
@@ -2999,7 +2999,7 @@ std::optional<InlineResult> llvm::getAttributeBasedInliningDecision(
29992999
// alloca, the inlined code would need to be adjusted to handle that the
30003000
// argument is in the alloca address space (so it is a little bit complicated
30013001
// to solve).
3002-
unsigned AllocaAS = Callee->getParent()->getDataLayout().getAllocaAddrSpace();
3002+
unsigned AllocaAS = Callee->getDataLayout().getAllocaAddrSpace();
30033003
for (unsigned I = 0, E = Call.arg_size(); I != E; ++I)
30043004
if (Call.isByValArgument(I)) {
30053005
PointerType *PTy = cast<PointerType>(Call.getArgOperand(I)->getType());

llvm/lib/Analysis/InstructionSimplify.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7248,7 +7248,7 @@ const SimplifyQuery getBestSimplifyQuery(Pass &P, Function &F) {
72487248
auto *TLI = TLIWP ? &TLIWP->getTLI(F) : nullptr;
72497249
auto *ACWP = P.getAnalysisIfAvailable<AssumptionCacheTracker>();
72507250
auto *AC = ACWP ? &ACWP->getAssumptionCache(F) : nullptr;
7251-
return {F.getParent()->getDataLayout(), TLI, DT, AC};
7251+
return {F.getDataLayout(), TLI, DT, AC};
72527252
}
72537253

72547254
const SimplifyQuery getBestSimplifyQuery(LoopStandardAnalysisResults &AR,
@@ -7262,7 +7262,7 @@ const SimplifyQuery getBestSimplifyQuery(AnalysisManager<T, TArgs...> &AM,
72627262
auto *DT = AM.template getCachedResult<DominatorTreeAnalysis>(F);
72637263
auto *TLI = AM.template getCachedResult<TargetLibraryAnalysis>(F);
72647264
auto *AC = AM.template getCachedResult<AssumptionAnalysis>(F);
7265-
return {F.getParent()->getDataLayout(), TLI, DT, AC};
7265+
return {F.getDataLayout(), TLI, DT, AC};
72667266
}
72677267
template const SimplifyQuery getBestSimplifyQuery(AnalysisManager<Function> &,
72687268
Function &);

llvm/lib/Analysis/LazyValueInfo.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1689,7 +1689,7 @@ LazyValueInfo LazyValueAnalysis::run(Function &F,
16891689
FunctionAnalysisManager &FAM) {
16901690
auto &AC = FAM.getResult<AssumptionAnalysis>(F);
16911691

1692-
return LazyValueInfo(&AC, &F.getParent()->getDataLayout());
1692+
return LazyValueInfo(&AC, &F.getDataLayout());
16931693
}
16941694

16951695
/// Returns true if we can statically tell that this value will never be a

llvm/lib/Analysis/Lint.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -709,7 +709,7 @@ Value *Lint::findValueImpl(Value *V, bool OffsetOk,
709709

710710
PreservedAnalyses LintPass::run(Function &F, FunctionAnalysisManager &AM) {
711711
auto *Mod = F.getParent();
712-
auto *DL = &F.getParent()->getDataLayout();
712+
auto *DL = &F.getDataLayout();
713713
auto *AA = &AM.getResult<AAManager>(F);
714714
auto *AC = &AM.getResult<AssumptionAnalysis>(F);
715715
auto *DT = &AM.getResult<DominatorTreeAnalysis>(F);

llvm/lib/Analysis/MemDerefPrinter.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ PreservedAnalyses MemDerefPrinterPass::run(Function &F,
2626
SmallVector<Value *, 4> Deref;
2727
SmallPtrSet<Value *, 4> DerefAndAligned;
2828

29-
const DataLayout &DL = F.getParent()->getDataLayout();
29+
const DataLayout &DL = F.getDataLayout();
3030
for (auto &I : instructions(F)) {
3131
if (LoadInst *LI = dyn_cast<LoadInst>(&I)) {
3232
Value *PO = LI->getPointerOperand();

llvm/lib/Analysis/ObjCARCAliasAnalysis.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,5 +142,5 @@ ModRefInfo ObjCARCAAResult::getModRefInfo(const CallBase *Call,
142142
AnalysisKey ObjCARCAA::Key;
143143

144144
ObjCARCAAResult ObjCARCAA::run(Function &F, FunctionAnalysisManager &AM) {
145-
return ObjCARCAAResult(F.getParent()->getDataLayout());
145+
return ObjCARCAAResult(F.getDataLayout());
146146
}

llvm/lib/Analysis/StackLifetime.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ void StackLifetime::collectMarkers() {
8787
DenseMap<const BasicBlock *, SmallDenseMap<const IntrinsicInst *, Marker>>
8888
BBMarkerSet;
8989

90-
const DataLayout &DL = F.getParent()->getDataLayout();
90+
const DataLayout &DL = F.getDataLayout();
9191

9292
// Compute the set of start/end markers per basic block.
9393
for (const BasicBlock *BB : depth_first(&F)) {

llvm/lib/Analysis/StackSafetyAnalysis.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -268,7 +268,7 @@ class StackSafetyLocalAnalysis {
268268

269269
public:
270270
StackSafetyLocalAnalysis(Function &F, ScalarEvolution &SE)
271-
: F(F), DL(F.getParent()->getDataLayout()), SE(SE),
271+
: F(F), DL(F.getDataLayout()), SE(SE),
272272
PointerSize(DL.getPointerSizeInBits()),
273273
UnknownRange(PointerSize, true) {}
274274

@@ -852,7 +852,7 @@ GVToSSI createGlobalStackSafetyInfo(
852852
}
853853

854854
uint32_t PointerSize =
855-
Copy.begin()->first->getParent()->getDataLayout().getPointerSizeInBits();
855+
Copy.begin()->first->getDataLayout().getPointerSizeInBits();
856856
StackSafetyDataFlowAnalysis<GlobalValue> SSDFA(PointerSize, std::move(Copy));
857857

858858
for (const auto &F : SSDFA.run()) {

llvm/lib/Analysis/TargetTransformInfo.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1354,7 +1354,7 @@ TargetIRAnalysis::Result TargetIRAnalysis::run(const Function &F,
13541354
AnalysisKey TargetIRAnalysis::Key;
13551355

13561356
TargetIRAnalysis::Result TargetIRAnalysis::getDefaultTTI(const Function &F) {
1357-
return Result(F.getParent()->getDataLayout());
1357+
return Result(F.getDataLayout());
13581358
}
13591359

13601360
// Register the basic pass.

llvm/lib/Analysis/ValueTracking.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6115,7 +6115,7 @@ bool llvm::getConstantDataArrayInfo(const Value *V,
61156115
// Fail if V is not based on constant global object.
61166116
return false;
61176117

6118-
const DataLayout &DL = GV->getParent()->getDataLayout();
6118+
const DataLayout &DL = GV->getDataLayout();
61196119
APInt Off(DL.getIndexTypeSizeInBits(V->getType()), 0);
61206120

61216121
if (GV != V->stripAndAccumulateConstantOffsets(DL, Off,

llvm/lib/AsmParser/LLParser.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8282,7 +8282,7 @@ int LLParser::parseCmpXchg(Instruction *&Inst, PerFunctionState &PFS) {
82828282
return error(NewLoc, "cmpxchg operand must be a first class value");
82838283

82848284
const Align DefaultAlignment(
8285-
PFS.getFunction().getParent()->getDataLayout().getTypeStoreSize(
8285+
PFS.getFunction().getDataLayout().getTypeStoreSize(
82868286
Cmp->getType()));
82878287

82888288
AtomicCmpXchgInst *CXI =
@@ -8388,13 +8388,13 @@ int LLParser::parseAtomicRMW(Instruction *&Inst, PerFunctionState &PFS) {
83888388
}
83898389

83908390
unsigned Size =
8391-
PFS.getFunction().getParent()->getDataLayout().getTypeStoreSizeInBits(
8391+
PFS.getFunction().getDataLayout().getTypeStoreSizeInBits(
83928392
Val->getType());
83938393
if (Size < 8 || (Size & (Size - 1)))
83948394
return error(ValLoc, "atomicrmw operand must be power-of-two byte-sized"
83958395
" integer");
83968396
const Align DefaultAlignment(
8397-
PFS.getFunction().getParent()->getDataLayout().getTypeStoreSize(
8397+
PFS.getFunction().getDataLayout().getTypeStoreSize(
83988398
Val->getType()));
83998399
AtomicRMWInst *RMWI =
84008400
new AtomicRMWInst(Operation, Ptr, Val,

llvm/lib/CodeGen/Analysis.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -730,7 +730,7 @@ bool llvm::returnTypeIsEligibleForTailCall(const Function *F,
730730
// index is compatible with the value we return.
731731
if (!slotOnlyDiscardsData(RetVal, CallVal, TmpRetPath, TmpCallPath,
732732
AllowDifferingSizes, TLI,
733-
F->getParent()->getDataLayout()))
733+
F->getDataLayout()))
734734
return false;
735735

736736
CallEmpty = !nextRealType(CallSubTypes, CallPath);

llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -783,7 +783,7 @@ void AsmPrinter::emitGlobalVariable(const GlobalVariable *GV) {
783783

784784
SectionKind GVKind = TargetLoweringObjectFile::getKindForGlobal(GV, TM);
785785

786-
const DataLayout &DL = GV->getParent()->getDataLayout();
786+
const DataLayout &DL = GV->getDataLayout();
787787
uint64_t Size = DL.getTypeAllocSize(GV->getValueType());
788788

789789
// If the alignment is specified, we *must* obey it. Overaligning a global
@@ -871,7 +871,7 @@ void AsmPrinter::emitGlobalVariable(const GlobalVariable *GV) {
871871
emitAlignment(Alignment, GV);
872872
OutStreamer->emitLabel(MangSym);
873873

874-
emitGlobalConstant(GV->getParent()->getDataLayout(),
874+
emitGlobalConstant(GV->getDataLayout(),
875875
GV->getInitializer());
876876
}
877877

@@ -911,7 +911,7 @@ void AsmPrinter::emitGlobalVariable(const GlobalVariable *GV) {
911911
if (LocalAlias != EmittedInitSym)
912912
OutStreamer->emitLabel(LocalAlias);
913913

914-
emitGlobalConstant(GV->getParent()->getDataLayout(), GV->getInitializer());
914+
emitGlobalConstant(GV->getDataLayout(), GV->getInitializer());
915915

916916
if (MAI->hasDotTypeDotSizeDirective())
917917
// .size foo, 42
@@ -935,7 +935,7 @@ void AsmPrinter::emitFunctionPrefix(ArrayRef<const Constant *> Prefix) {
935935
const Function &F = MF->getFunction();
936936
if (!MAI->hasSubsectionsViaSymbols()) {
937937
for (auto &C : Prefix)
938-
emitGlobalConstant(F.getParent()->getDataLayout(), C);
938+
emitGlobalConstant(F.getDataLayout(), C);
939939
return;
940940
}
941941
// Preserving prefix-like data on platforms which use subsections-via-symbols
@@ -945,7 +945,7 @@ void AsmPrinter::emitFunctionPrefix(ArrayRef<const Constant *> Prefix) {
945945
OutStreamer->emitLabel(OutContext.createLinkerPrivateTempSymbol());
946946

947947
for (auto &C : Prefix) {
948-
emitGlobalConstant(F.getParent()->getDataLayout(), C);
948+
emitGlobalConstant(F.getDataLayout(), C);
949949
}
950950

951951
// Emit an .alt_entry directive for the actual function symbol.
@@ -1080,7 +1080,7 @@ void AsmPrinter::emitFunctionHeader() {
10801080

10811081
// Emit the prologue data.
10821082
if (F.hasPrologueData())
1083-
emitGlobalConstant(F.getParent()->getDataLayout(), F.getPrologueData());
1083+
emitGlobalConstant(F.getDataLayout(), F.getPrologueData());
10841084
}
10851085

10861086
/// EmitFunctionEntryLabel - Emit the label that is the entrypoint for the
@@ -1528,7 +1528,7 @@ void AsmPrinter::emitKCFITrapEntry(const MachineFunction &MF,
15281528
void AsmPrinter::emitKCFITypeId(const MachineFunction &MF) {
15291529
const Function &F = MF.getFunction();
15301530
if (const MDNode *MD = F.getMetadata(LLVMContext::MD_kcfi_type))
1531-
emitGlobalConstant(F.getParent()->getDataLayout(),
1531+
emitGlobalConstant(F.getDataLayout(),
15321532
mdconst::extract<ConstantInt>(MD->getOperand(0)));
15331533
}
15341534

@@ -1678,7 +1678,7 @@ void AsmPrinter::emitPCSections(const MachineFunction &MF) {
16781678
for (const MDOperand &AuxMDO : AuxMDs->operands()) {
16791679
assert(isa<ConstantAsMetadata>(AuxMDO) && "expecting a constant");
16801680
const Constant *C = cast<ConstantAsMetadata>(AuxMDO)->getValue();
1681-
const DataLayout &DL = F.getParent()->getDataLayout();
1681+
const DataLayout &DL = F.getDataLayout();
16821682
const uint64_t Size = DL.getTypeStoreSize(C->getType());
16831683

16841684
if (auto *CI = dyn_cast<ConstantInt>(C);
@@ -2926,14 +2926,14 @@ bool AsmPrinter::emitSpecialLLVMGlobal(const GlobalVariable *GV) {
29262926
assert(GV->hasInitializer() && "Not a special LLVM global!");
29272927

29282928
if (GV->getName() == "llvm.global_ctors") {
2929-
emitXXStructorList(GV->getParent()->getDataLayout(), GV->getInitializer(),
2929+
emitXXStructorList(GV->getDataLayout(), GV->getInitializer(),
29302930
/* isCtor */ true);
29312931

29322932
return true;
29332933
}
29342934

29352935
if (GV->getName() == "llvm.global_dtors") {
2936-
emitXXStructorList(GV->getParent()->getDataLayout(), GV->getInitializer(),
2936+
emitXXStructorList(GV->getDataLayout(), GV->getInitializer(),
29372937
/* isCtor */ false);
29382938

29392939
return true;
@@ -3147,7 +3147,7 @@ void AsmPrinter::emitLabelPlusOffset(const MCSymbol *Label, uint64_t Offset,
31473147
void AsmPrinter::emitAlignment(Align Alignment, const GlobalObject *GV,
31483148
unsigned MaxBytesToEmit) const {
31493149
if (GV)
3150-
Alignment = getGVAlignment(GV, GV->getParent()->getDataLayout(), Alignment);
3150+
Alignment = getGVAlignment(GV, GV->getDataLayout(), Alignment);
31513151

31523152
if (Alignment == Align(1))
31533153
return; // 1-byte aligned: no need to emit alignment.

llvm/lib/CodeGen/AssignmentTrackingAnalysis.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2184,7 +2184,7 @@ static AssignmentTrackingLowering::OverlapMap buildOverlapMapAndRecordDeclares(
21842184
if (auto *DII = dyn_cast<DbgVariableIntrinsic>(&I)) {
21852185
ProcessDbgRecord(DII, InstDeclares);
21862186
} else if (auto Info = getUntaggedStoreAssignmentInfo(
2187-
I, Fn.getParent()->getDataLayout())) {
2187+
I, Fn.getDataLayout())) {
21882188
// Find markers linked to this alloca.
21892189
auto HandleDbgAssignForStore = [&](auto *Assign) {
21902190
std::optional<DIExpression::FragmentInfo> FragInfo;
@@ -2800,7 +2800,7 @@ DebugAssignmentTrackingAnalysis::run(Function &F,
28002800
if (!isAssignmentTrackingEnabled(*F.getParent()))
28012801
return FunctionVarLocs();
28022802

2803-
auto &DL = F.getParent()->getDataLayout();
2803+
auto &DL = F.getDataLayout();
28042804

28052805
FunctionVarLocsBuilder Builder;
28062806
analyzeFunction(F, DL, &Builder);

0 commit comments

Comments
 (0)