aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeremy Morse <jeremy.morse@sony.com>2025-01-27 16:07:27 +0000
committerGitHub <noreply@github.com>2025-01-27 16:07:27 +0000
commit749443a307e8e47a25a5552cbeb27f69845e6ce8 (patch)
treeff349b454a1c2166f5ed63c72a62938bac2e7adb
parent1bb784a7489e901fd46ce9b77cdc0ab8840a4f3d (diff)
downloadllvm-749443a307e8e47a25a5552cbeb27f69845e6ce8.zip
llvm-749443a307e8e47a25a5552cbeb27f69845e6ce8.tar.gz
llvm-749443a307e8e47a25a5552cbeb27f69845e6ce8.tar.bz2
[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 ).
-rw-r--r--llvm/lib/SandboxIR/Instruction.cpp2
-rw-r--r--llvm/lib/SandboxIR/Tracker.cpp4
-rw-r--r--mlir/lib/Target/LLVMIR/Dialect/OpenMP/OpenMPToLLVMIRTranslation.cpp2
3 files changed, 4 insertions, 4 deletions
diff --git a/llvm/lib/SandboxIR/Instruction.cpp b/llvm/lib/SandboxIR/Instruction.cpp
index cc96141..956047c 100644
--- a/llvm/lib/SandboxIR/Instruction.cpp
+++ b/llvm/lib/SandboxIR/Instruction.cpp
@@ -129,7 +129,7 @@ void Instruction::insertBefore(Instruction *BeforeI) {
// Insert the LLVM IR Instructions in program order.
for (llvm::Instruction *I : getLLVMInstrs())
- I->insertBefore(BeforeTopI);
+ I->insertBefore(BeforeTopI->getIterator());
}
void Instruction::insertAfter(Instruction *AfterI) {
diff --git a/llvm/lib/SandboxIR/Tracker.cpp b/llvm/lib/SandboxIR/Tracker.cpp
index 27ed37a..5fa9f1810 100644
--- a/llvm/lib/SandboxIR/Tracker.cpp
+++ b/llvm/lib/SandboxIR/Tracker.cpp
@@ -175,7 +175,7 @@ void EraseFromParent::revert(Tracker &Tracker) {
// Place the bottom-most instruction first.
auto [Operands, BotLLVMI] = InstrData[0];
if (auto *NextLLVMI = dyn_cast<llvm::Instruction *>(NextLLVMIOrBB)) {
- BotLLVMI->insertBefore(NextLLVMI);
+ BotLLVMI->insertBefore(NextLLVMI->getIterator());
} else {
auto *LLVMBB = cast<llvm::BasicBlock *>(NextLLVMIOrBB);
BotLLVMI->insertInto(LLVMBB, LLVMBB->end());
@@ -185,7 +185,7 @@ void EraseFromParent::revert(Tracker &Tracker) {
// Go over the rest of the instructions and stack them on top.
for (auto [Operands, LLVMI] : drop_begin(InstrData)) {
- LLVMI->insertBefore(BotLLVMI);
+ LLVMI->insertBefore(BotLLVMI->getIterator());
for (auto [OpNum, Op] : enumerate(Operands))
LLVMI->setOperand(OpNum, Op);
BotLLVMI = LLVMI;
diff --git a/mlir/lib/Target/LLVMIR/Dialect/OpenMP/OpenMPToLLVMIRTranslation.cpp b/mlir/lib/Target/LLVMIR/Dialect/OpenMP/OpenMPToLLVMIRTranslation.cpp
index 3fcdefa..eb873fd 100644
--- a/mlir/lib/Target/LLVMIR/Dialect/OpenMP/OpenMPToLLVMIRTranslation.cpp
+++ b/mlir/lib/Target/LLVMIR/Dialect/OpenMP/OpenMPToLLVMIRTranslation.cpp
@@ -3828,7 +3828,7 @@ handleDeclareTargetMapVar(MapInfoData &mapData,
if (insn->getFunction() == func) {
auto *load = builder.CreateLoad(mapData.BasePointers[i]->getType(),
mapData.BasePointers[i]);
- load->moveBefore(insn);
+ load->moveBefore(insn->getIterator());
user->replaceUsesOfWith(mapData.OriginalValue[i], load);
}
}