[llvm] [GVN] Improve processBlock for instruction erasure (PR #131753)

Nikita Popov via llvm-commits llvm-commits at lists.llvm.org
Fri Apr 11 06:00:42 PDT 2025


================
@@ -137,9 +139,11 @@ class GVNPass : public PassInfoMixin<GVNPass> {
 
   /// This removes the specified instruction from
   /// our various maps and marks it for deletion.
-  void markInstructionForDeletion(Instruction *I) {
+  void doInstructionDeletion(Instruction *I) {
+    salvageKnowledge(I, AC);
+    salvageDebugInfo(*I);
     VN.erase(I);
-    InstrsToErase.push_back(I);
+    removeInstruction(I);
----------------
nikic wrote:

Can we move the VN.erase() operation inside removeInstruction()? It looks like all calls to removeInstruction() also perform VN.erase() first.

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


More information about the llvm-commits mailing list