Skip to content

Commit 72c69ae

Browse files
authored
[AMDGPU] Make use of getFunction and getMF. NFC. (#167872)
1 parent 3890c97 commit 72c69ae

28 files changed

+67
-69
lines changed

llvm/lib/Target/AMDGPU/AMDGPUAlwaysInlinePass.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ recursivelyVisitUsers(GlobalValue &GV,
6565
continue;
6666

6767
if (Instruction *I = dyn_cast<Instruction>(U)) {
68-
Function *F = I->getParent()->getParent();
68+
Function *F = I->getFunction();
6969
if (!AMDGPU::isEntryFunctionCC(F->getCallingConv())) {
7070
// FIXME: This is a horrible hack. We should always respect noinline,
7171
// and just let us hit the error when we can't handle this.

llvm/lib/Target/AMDGPU/AMDGPUIGroupLP.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1968,7 +1968,7 @@ class MFMASmallGemmSingleWaveOpt final : public IGLPStrategy {
19681968
int NumBits = 0;
19691969

19701970
auto TRI = TII->getRegisterInfo();
1971-
auto &MRI = MI->getParent()->getParent()->getRegInfo();
1971+
auto &MRI = MI->getMF()->getRegInfo();
19721972
for (auto &Elt : Collection) {
19731973
auto Op = Elt->getInstr()->getOperand(0);
19741974
auto Size =

llvm/lib/Target/AMDGPU/AMDGPUISelLowering.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1216,7 +1216,7 @@ void AMDGPUTargetLowering::analyzeFormalArgumentsCompute(
12161216
const SmallVectorImpl<ISD::InputArg> &Ins) const {
12171217
const MachineFunction &MF = State.getMachineFunction();
12181218
const Function &Fn = MF.getFunction();
1219-
LLVMContext &Ctx = Fn.getParent()->getContext();
1219+
LLVMContext &Ctx = Fn.getContext();
12201220
const AMDGPUSubtarget &ST = AMDGPUSubtarget::get(MF);
12211221
const unsigned ExplicitOffset = ST.getExplicitKernelArgOffset();
12221222
CallingConv::ID CC = Fn.getCallingConv();

llvm/lib/Target/AMDGPU/AMDGPUInstructionSelector.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1998,7 +1998,7 @@ bool AMDGPUInstructionSelector::selectDSAppendConsume(MachineInstr &MI,
19981998
}
19991999

20002000
bool AMDGPUInstructionSelector::selectInitWholeWave(MachineInstr &MI) const {
2001-
MachineFunction *MF = MI.getParent()->getParent();
2001+
MachineFunction *MF = MI.getMF();
20022002
SIMachineFunctionInfo *MFInfo = MF->getInfo<SIMachineFunctionInfo>();
20032003

20042004
MFInfo->setInitWholeWave();
@@ -3690,7 +3690,7 @@ bool AMDGPUInstructionSelector::selectBVHIntersectRayIntrinsic(
36903690
MI.getOpcode() == AMDGPU::G_AMDGPU_BVH_INTERSECT_RAY ? 1 : 3;
36913691
MI.setDesc(TII.get(MI.getOperand(OpcodeOpIdx).getImm()));
36923692
MI.removeOperand(OpcodeOpIdx);
3693-
MI.addImplicitDefUseOperands(*MI.getParent()->getParent());
3693+
MI.addImplicitDefUseOperands(*MI.getMF());
36943694
return constrainSelectedInstRegOperands(MI, TII, TRI, RBI);
36953695
}
36963696

@@ -3793,7 +3793,7 @@ bool AMDGPUInstructionSelector::selectSMFMACIntrin(MachineInstr &MI) const {
37933793
MI.removeOperand(4); // VDst_In
37943794
MI.removeOperand(1); // Intrinsic ID
37953795
MI.addOperand(VDst_In); // Readd VDst_In to the end
3796-
MI.addImplicitDefUseOperands(*MI.getParent()->getParent());
3796+
MI.addImplicitDefUseOperands(*MI.getMF());
37973797
const MCInstrDesc &MCID = MI.getDesc();
37983798
if (MCID.getOperandConstraint(0, MCOI::EARLY_CLOBBER) != -1) {
37993799
MI.getOperand(0).setIsEarlyClobber(true);

llvm/lib/Target/AMDGPU/AMDGPULibCalls.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -845,7 +845,7 @@ bool AMDGPULibCalls::TDOFold(CallInst *CI, const FuncInfo &FInfo) {
845845
return false;
846846
}
847847
}
848-
LLVMContext &context = CI->getParent()->getParent()->getContext();
848+
LLVMContext &context = CI->getContext();
849849
Constant *nval;
850850
if (getArgType(FInfo) == AMDGPULibFunc::F32) {
851851
SmallVector<float, 0> FVal;

llvm/lib/Target/AMDGPU/AMDGPULowerKernelArguments.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ static bool lowerKernelArguments(Function &F, const TargetMachine &TM) {
6464
return false;
6565

6666
const GCNSubtarget &ST = TM.getSubtarget<GCNSubtarget>(F);
67-
LLVMContext &Ctx = F.getParent()->getContext();
67+
LLVMContext &Ctx = F.getContext();
6868
const DataLayout &DL = F.getDataLayout();
6969
BasicBlock &EntryBlock = *F.begin();
7070
IRBuilder<> Builder(&EntryBlock, getInsertPt(EntryBlock));

llvm/lib/Target/AMDGPU/AMDGPULowerKernelAttributes.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ static void annotateGridSizeLoadWithRangeMD(LoadInst *Load,
9898
}
9999

100100
static bool processUse(CallInst *CI, bool IsV5OrAbove) {
101-
Function *F = CI->getParent()->getParent();
101+
Function *F = CI->getFunction();
102102

103103
auto *MD = F->getMetadata("reqd_work_group_size");
104104
const bool HasReqdWorkGroupSize = MD && MD->getNumOperands() == 3;

llvm/lib/Target/AMDGPU/AMDGPUMCInstLower.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -243,7 +243,7 @@ void AMDGPUMCInstLower::lower(const MachineInstr *MI, MCInst &OutMI) const {
243243

244244
int MCOpcode = TII->pseudoToMCOpcode(Opcode);
245245
if (MCOpcode == -1) {
246-
LLVMContext &C = MI->getParent()->getParent()->getFunction().getContext();
246+
LLVMContext &C = MI->getMF()->getFunction().getContext();
247247
C.emitError("AMDGPUMCInstLower::lower - Pseudo instruction doesn't have "
248248
"a target-specific version: " + Twine(MI->getOpcode()));
249249
}
@@ -332,7 +332,7 @@ void AMDGPUAsmPrinter::emitInstruction(const MachineInstr *MI) {
332332

333333
StringRef Err;
334334
if (!STI.getInstrInfo()->verifyInstruction(*MI, Err)) {
335-
LLVMContext &C = MI->getParent()->getParent()->getFunction().getContext();
335+
LLVMContext &C = MI->getMF()->getFunction().getContext();
336336
C.emitError("Illegal instruction detected: " + Err);
337337
MI->print(errs());
338338
}

llvm/lib/Target/AMDGPU/AMDGPUPreLegalizerCombiner.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -177,8 +177,7 @@ void AMDGPUPreLegalizerCombinerImpl::applyClampI64ToI16(
177177
MachineInstr &MI, const ClampI64ToI16MatchInfo &MatchInfo) const {
178178

179179
Register Src = MatchInfo.Origin;
180-
assert(MI.getParent()->getParent()->getRegInfo().getType(Src) ==
181-
LLT::scalar(64));
180+
assert(MI.getMF()->getRegInfo().getType(Src) == LLT::scalar(64));
182181
const LLT S32 = LLT::scalar(32);
183182

184183
auto Unmerge = B.buildUnmerge(S32, Src);

llvm/lib/Target/AMDGPU/AMDGPUPreloadKernelArguments.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ class PreloadKernelArgInfo {
127127
// will also be preloaded even if that data is unused.
128128
Function *cloneFunctionWithPreloadImplicitArgs(unsigned LastPreloadIndex) {
129129
FunctionType *FT = F.getFunctionType();
130-
LLVMContext &Ctx = F.getParent()->getContext();
130+
LLVMContext &Ctx = F.getContext();
131131
SmallVector<Type *, 16> FTypes(FT->param_begin(), FT->param_end());
132132
for (unsigned I = 0; I <= LastPreloadIndex; ++I)
133133
FTypes.push_back(getHiddenArgType(Ctx, HiddenArg(I)));
@@ -196,7 +196,7 @@ class PreloadKernelArgInfo {
196196
SmallVector<std::pair<LoadInst *, unsigned>, 4> ImplicitArgLoads;
197197
for (auto *U : ImplicitArgPtr->users()) {
198198
Instruction *CI = dyn_cast<Instruction>(U);
199-
if (!CI || CI->getParent()->getParent() != &F)
199+
if (!CI || CI->getFunction() != &F)
200200
continue;
201201

202202
for (auto *U : CI->users()) {
@@ -213,7 +213,7 @@ class PreloadKernelArgInfo {
213213
continue;
214214

215215
// FIXME: Expand handle merged loads.
216-
LLVMContext &Ctx = F.getParent()->getContext();
216+
LLVMContext &Ctx = F.getContext();
217217
Type *LoadTy = Load->getType();
218218
HiddenArg HA = getHiddenArgFromOffset(Offset);
219219
if (HA == END_HIDDEN_ARGS || LoadTy != getHiddenArgType(Ctx, HA))

0 commit comments

Comments
 (0)