[llvm] [SandboxIR][Tracker] Track eraseFromParent() (PR #99431)
via llvm-commits
llvm-commits at lists.llvm.org
Thu Jul 18 10:19:29 PDT 2024
================
@@ -41,6 +41,62 @@ Tracker::~Tracker() {
assert(Changes.empty() && "You must accept or revert changes!");
}
+EraseFromParent::EraseFromParent(std::unique_ptr<sandboxir::Value> &&ErasedIPtr,
+ Tracker &Tracker)
+ : IRChangeBase(Tracker), ErasedIPtr(std::move(ErasedIPtr)) {
+ auto *I = cast<Instruction>(this->ErasedIPtr.get());
+ auto LLVMInstrs = I->getLLVMInstrs();
+ // Iterate in reverse program order.
+ for (auto *LLVMI : reverse(LLVMInstrs)) {
+ SmallVector<InstrData::OpData> OpDataVec;
+ for (auto [OpNum, Use] : enumerate(LLVMI->operands()))
+ OpDataVec.push_back({Use.get(), static_cast<unsigned>(OpNum)});
+ InstrData.push_back({OpDataVec, LLVMI});
+ }
+#ifndef NDEBUG
----------------
vporpo wrote:
I replaced it with `assert(is_sorted())`
https://github.com/llvm/llvm-project/pull/99431
More information about the llvm-commits
mailing list