Skip to content

Commit 18a4da8

Browse files
committed
[NFC] Cleanup: Remove uses of BasicBlock::getInstList().
This is part of a series of patches that aim at making Function::getInstList() private. Differential Revision: https://reviews.llvm.org/D139971
1 parent eaade37 commit 18a4da8

File tree

6 files changed

+10
-10
lines changed

6 files changed

+10
-10
lines changed

llvm/lib/Target/BPF/BPFAbstractMemberAccess.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ Instruction *BPFCoreSharedInfo::insertPassThrough(Module *M, BasicBlock *BB,
107107
BPFCoreSharedInfo::SeqNum++);
108108

109109
auto *NewInst = CallInst::Create(Fn, {SeqNumVal, Input});
110-
BB->getInstList().insert(Before->getIterator(), NewInst);
110+
NewInst->insertBefore(Before);
111111
return NewInst;
112112
}
113113
} // namespace llvm
@@ -1135,16 +1135,16 @@ bool BPFAbstractMemberAccess::transformGEPChain(CallInst *Call,
11351135

11361136
// Generate a BitCast
11371137
auto *BCInst = new BitCastInst(Base, Type::getInt8PtrTy(BB->getContext()));
1138-
BB->getInstList().insert(Call->getIterator(), BCInst);
1138+
BCInst->insertBefore(Call);
11391139

11401140
// Generate a GetElementPtr
11411141
auto *GEP = GetElementPtrInst::Create(Type::getInt8Ty(BB->getContext()),
11421142
BCInst, LDInst);
1143-
BB->getInstList().insert(Call->getIterator(), GEP);
1143+
GEP->insertBefore(Call);
11441144

11451145
// Generate a BitCast
11461146
auto *BCInst2 = new BitCastInst(GEP, Call->getType());
1147-
BB->getInstList().insert(Call->getIterator(), BCInst2);
1147+
BCInst2->insertBefore(Call);
11481148

11491149
// For the following code,
11501150
// Block0:

llvm/lib/Target/BPF/BPFAdjustOpt.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ bool BPFAdjustOptImpl::adjustICmpToBuiltin() {
146146
Function *Fn = Intrinsic::getDeclaration(
147147
M, Intrinsic::bpf_compare, {Op0->getType(), ConstOp1->getType()});
148148
auto *NewInst = CallInst::Create(Fn, {Opcode, Op0, ConstOp1});
149-
BB.getInstList().insert(I.getIterator(), NewInst);
149+
NewInst->insertBefore(&I);
150150
Icmp->replaceAllUsesWith(NewInst);
151151
Changed = true;
152152
ToBeDeleted = Icmp;

llvm/lib/Target/BPF/BPFCheckAndAdjustIR.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ bool BPFCheckAndAdjustIR::removeCompareBuiltin(Module &M) {
153153
CmpInst::Predicate Opcode = (CmpInst::Predicate)OpVal;
154154

155155
auto *ICmp = new ICmpInst(Opcode, Arg1, Arg2);
156-
BB.getInstList().insert(Call->getIterator(), ICmp);
156+
ICmp->insertBefore(Call);
157157

158158
Call->replaceAllUsesWith(ICmp);
159159
ToBeDeleted = Call;

llvm/lib/Target/Hexagon/HexagonLoopIdiomRecognition.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -522,7 +522,7 @@ void Simplifier::Context::link(Instruction *I, BasicBlock *B,
522522
link(OpI, B, At);
523523
}
524524

525-
B->getInstList().insert(At, I);
525+
I->insertAt(B, At);
526526
}
527527

528528
Value *Simplifier::Context::materialize(BasicBlock *B,

llvm/lib/Target/WebAssembly/WebAssemblyFixFunctionBitcasts.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ static Function *createWrapper(Function *F, FunctionType *Ty) {
141141
if (CastInst::isBitOrNoopPointerCastable(ArgType, ParamType, DL)) {
142142
Instruction *PtrCast =
143143
CastInst::CreateBitOrPointerCast(AI, ParamType, "cast");
144-
BB->getInstList().push_back(PtrCast);
144+
PtrCast->insertAt(BB, BB->end());
145145
Args.push_back(PtrCast);
146146
} else if (ArgType->isStructTy() || ParamType->isStructTy()) {
147147
LLVM_DEBUG(dbgs() << "createWrapper: struct param type in bitcast: "
@@ -181,7 +181,7 @@ static Function *createWrapper(Function *F, FunctionType *Ty) {
181181
DL)) {
182182
Instruction *Cast =
183183
CastInst::CreateBitOrPointerCast(Call, RtnType, "cast");
184-
BB->getInstList().push_back(Cast);
184+
Cast->insertAt(BB, BB->end());
185185
ReturnInst::Create(M->getContext(), Cast, BB);
186186
} else if (RtnType->isStructTy() || ExpectedRtnType->isStructTy()) {
187187
LLVM_DEBUG(dbgs() << "createWrapper: struct return type in bitcast: "

llvm/lib/Target/WebAssembly/WebAssemblyLowerEmscriptenEHSjLj.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1630,7 +1630,7 @@ void WebAssemblyLowerEmscriptenEHSjLj::handleLongjmpableCallsForEmscriptenSjLj(
16301630

16311631
// Create switch instruction
16321632
IRB.SetInsertPoint(EndBB);
1633-
IRB.SetCurrentDebugLocation(EndBB->getInstList().back().getDebugLoc());
1633+
IRB.SetCurrentDebugLocation(EndBB->back().getDebugLoc());
16341634
SwitchInst *SI = IRB.CreateSwitch(Label, Tail, SetjmpRetPHIs.size());
16351635
// -1 means no longjmp happened, continue normally (will hit the default
16361636
// switch case). 0 means a longjmp that is not ours to handle, needs a

0 commit comments

Comments
 (0)