[llvm] [SandboxVec][VecUtils] Introduce DeadInstrMorgue (PR #221482)

Anshil Gandhi via llvm-commits llvm-commits at lists.llvm.org
Wed Sep 9 14:46:38 PDT 2026


================
@@ -403,6 +403,40 @@ class VecUtils {
     }
   };
 
+  /// Utility class to collect and erase dead instructions.
+  class DeadInstructionMorgue {
+  public:
+    DeadInstructionMorgue() = default;
+    DeadInstructionMorgue(const DeadInstructionMorgue &) = delete;
+
+    /// After we create vectors for groups of instructions, the original
+    /// instructions are potentially dead and may need to be removed. This
+    /// function helps collect these instructions (along with the pointer
+    /// operands for loads/stores) so that they can be cleaned up later.
+    void collectPotentiallyDeadInstrs(ArrayRef<Value *> Bndl);
+
+    /// Erases all dead instructions from the dead instruction candidates
+    /// collected during vectorization. Also clear the DeadInstrCandidates.
----------------
gandhi56 wrote:

Rewrote the documentation here as well.

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


More information about the llvm-commits mailing list