[llvm] [SandboxIR][Tracker] Track eraseFromParent() (PR #99431)
via llvm-commits
llvm-commits at lists.llvm.org
Thu Jul 18 10:48:05 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:
OK we can a new context class, like `class TestContext : public Context` that can match a multi-instruction pattern like for example a 2-instruction sequence of a `sub` followed by an `add`. Then in the tests we need to test multi-instructions we can use that `TestContext` instead of the standard `Context`.
Yeah that would have to be a separate PR. I am pretty sure there is a lot of missing functionality in the SandboxIR API that would need fixing and more testing too once we introduce multi-instructions.
https://github.com/llvm/llvm-project/pull/99431
More information about the llvm-commits
mailing list