[PATCH] D50422: SCEV should forget all loops containing a deleted block.

Alina Sbirlea via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Aug 7 17:11:02 PDT 2018


asbirlea created this revision.
asbirlea added reviewers: greened, mkazantsev, sanjoy.
Herald added subscribers: javed.absar, jlebar.

LoopSimplifyCFG should update ScEv for all loops after a block is deleted.
If the deleted block "Succ" is part of L, then it is part of all parent loops, so forget all parent loops as well.


Repository:
  rL LLVM

https://reviews.llvm.org/D50422

Files:
  lib/Transforms/Scalar/LoopSimplifyCFG.cpp


Index: lib/Transforms/Scalar/LoopSimplifyCFG.cpp
===================================================================
--- lib/Transforms/Scalar/LoopSimplifyCFG.cpp
+++ lib/Transforms/Scalar/LoopSimplifyCFG.cpp
@@ -61,7 +61,12 @@
     // Merge Succ into Pred and delete it.
     MergeBlockIntoPredecessor(Succ, &DTU, &LI);
 
+    // Deleted block Succ was part of loop L and all its parent loops.
     SE.forgetLoop(&L);
+    auto *LoopForget = &L;
+    while ((LoopForget = LoopForget->getParentLoop()))
+      SE.forgetLoop(LoopForget);
+
     Changed = true;
   }
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D50422.159628.patch
Type: text/x-patch
Size: 567 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180808/2c48a18f/attachment.bin>


More information about the llvm-commits mailing list