]> granicus.if.org Git - llvm/commitdiff
[GVN][NFC] Mark instruction for deletion instead of immediate erasing in LoadPRE
authorMax Kazantsev <max.kazantsev@azul.com>
Mon, 30 Oct 2017 04:48:34 +0000 (04:48 +0000)
committerMax Kazantsev <max.kazantsev@azul.com>
Mon, 30 Oct 2017 04:48:34 +0000 (04:48 +0000)
It is done to uniformly handle instructions removal.

Differential Revision: https://reviews.llvm.org/D39369

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@316884 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Transforms/Scalar/GVN.cpp

index d7dcfd2eb1643d8368f61e5c7d9bbad1c537d8db..7e416368468746937a54c3ff4b5778d8907b0d67 100644 (file)
@@ -1167,8 +1167,7 @@ bool GVN::PerformLoadPRE(LoadInst *LI, AvailValInBlkVect &ValuesPerBlock,
   if (!CanDoPRE) {
     while (!NewInsts.empty()) {
       Instruction *I = NewInsts.pop_back_val();
-      if (MD) MD->removeInstruction(I);
-      I->eraseFromParent();
+      markInstructionForDeletion(I);
     }
     // HINT: Don't revert the edge-splitting as following transformation may
     // also need to split these critical edges.