[PATCH] D52073: [GVN][NFC] Use more surgical updates to save some compile time

Max Kazantsev via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Sep 13 22:22:04 PDT 2018


mkazantsev created this revision.
mkazantsev added reviewers: efriedma, john.brawn, fhahn.

Rather than unconditionally discard blocks in ICF and then trigger their recalculation,
we can only drop cached info when we actually change the first ICF instruction.


https://reviews.llvm.org/D52073

Files:
  lib/Transforms/Scalar/GVN.cpp


Index: lib/Transforms/Scalar/GVN.cpp
===================================================================
--- lib/Transforms/Scalar/GVN.cpp
+++ lib/Transforms/Scalar/GVN.cpp
@@ -2077,12 +2077,12 @@
       assert(I->getParent() == BB && "Removing instruction from wrong block?");
       LLVM_DEBUG(dbgs() << "GVN removed: " << *I << '\n');
       salvageDebugInfo(*I);
+      ICF->invalidateInstruction(I);
       if (MD) MD->removeInstruction(I);
       LLVM_DEBUG(verifyRemoved(I));
       I->eraseFromParent();
     }
 
-    ICF->invalidateBlock(BB);
     InstrsToErase.clear();
 
     if (AtStart)
@@ -2291,7 +2291,7 @@
   LLVM_DEBUG(verifyRemoved(CurInst));
   // FIXME: Intended to be markInstructionForDeletion(CurInst), but it causes
   // some assertion failures.
-  ICF->invalidateBlock(CurrentBlock);
+  ICF->invalidateInstruction(CurInst);
   CurInst->eraseFromParent();
   ++NumGVNInstr;
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D52073.165423.patch
Type: text/x-patch
Size: 901 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180914/3d180e1c/attachment.bin>


More information about the llvm-commits mailing list