Skip to content

Commit 749443a

Browse files
authored
[NFC][DebugInfo] Mop up final instruction-insertion call sites (#124289)
These are the final places in the monorepo that make use of instruction insertion for methods like insertBefore and moveBefore. As part of the RemoveDIs project, instead use iterators for insertion. (see: https://discourse.llvm.org/t/rfc-instruction-api-changes-needed-to-eliminate-debug-intrinsics-from-ir/68939 ).
1 parent 1bb784a commit 749443a

File tree

3 files changed

+4
-4
lines changed

3 files changed

+4
-4
lines changed

llvm/lib/SandboxIR/Instruction.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ void Instruction::insertBefore(Instruction *BeforeI) {
129129

130130
// Insert the LLVM IR Instructions in program order.
131131
for (llvm::Instruction *I : getLLVMInstrs())
132-
I->insertBefore(BeforeTopI);
132+
I->insertBefore(BeforeTopI->getIterator());
133133
}
134134

135135
void Instruction::insertAfter(Instruction *AfterI) {

llvm/lib/SandboxIR/Tracker.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,7 @@ void EraseFromParent::revert(Tracker &Tracker) {
175175
// Place the bottom-most instruction first.
176176
auto [Operands, BotLLVMI] = InstrData[0];
177177
if (auto *NextLLVMI = dyn_cast<llvm::Instruction *>(NextLLVMIOrBB)) {
178-
BotLLVMI->insertBefore(NextLLVMI);
178+
BotLLVMI->insertBefore(NextLLVMI->getIterator());
179179
} else {
180180
auto *LLVMBB = cast<llvm::BasicBlock *>(NextLLVMIOrBB);
181181
BotLLVMI->insertInto(LLVMBB, LLVMBB->end());
@@ -185,7 +185,7 @@ void EraseFromParent::revert(Tracker &Tracker) {
185185

186186
// Go over the rest of the instructions and stack them on top.
187187
for (auto [Operands, LLVMI] : drop_begin(InstrData)) {
188-
LLVMI->insertBefore(BotLLVMI);
188+
LLVMI->insertBefore(BotLLVMI->getIterator());
189189
for (auto [OpNum, Op] : enumerate(Operands))
190190
LLVMI->setOperand(OpNum, Op);
191191
BotLLVMI = LLVMI;

mlir/lib/Target/LLVMIR/Dialect/OpenMP/OpenMPToLLVMIRTranslation.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3828,7 +3828,7 @@ handleDeclareTargetMapVar(MapInfoData &mapData,
38283828
if (insn->getFunction() == func) {
38293829
auto *load = builder.CreateLoad(mapData.BasePointers[i]->getType(),
38303830
mapData.BasePointers[i]);
3831-
load->moveBefore(insn);
3831+
load->moveBefore(insn->getIterator());
38323832
user->replaceUsesOfWith(mapData.OriginalValue[i], load);
38333833
}
38343834
}

0 commit comments

Comments
 (0)