[llvm] [SandboxIR][Tracker] Track eraseFromParent() (PR #99431)

via llvm-commits llvm-commits at lists.llvm.org
Thu Jul 18 10:29:00 PDT 2024


================
@@ -99,6 +100,46 @@ class UseSet : public IRChangeBase {
 #endif
 };
 
+class EraseFromParent : public IRChangeBase {
+  /// Contains all the data we need to restore an "erased" (i.e., detached)
+  /// instruction: the instruction itself and the operands data.
+  struct InstrData {
+    /// The operand and the corresponding operand number.
+    struct OpData {
+      llvm::Value *Op;
+      unsigned OpNum;
+    };
+    /// The operands that got dropped.
+    SmallVector<OpData> OpDataVec;
+    /// The instruction that got "erased".
+    llvm::Instruction *LLVMI;
+  };
+  /// The instruction data is in reverse program order, which helps create the
+  /// original program order during revert().
+  SmallVector<InstrData> InstrData;
----------------
vporpo wrote:

Yeah, multi-instructions are in the vectorizer-specific extension of SandboxIR. The easiest way would be to just re-test the tracker with multi-instructions once they get introduced. This is what I've done in the prototype.

Not sure how we would exercise the code without introducing some kind of dummy multi-instruction just for testing. But that would have to get registered properly in the def file, and we would need to enforce that it's not created by the user.
Any thoughts?

https://github.com/llvm/llvm-project/pull/99431


More information about the llvm-commits mailing list