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

Alina Sbirlea via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Aug 8 09:53:42 PDT 2018


asbirlea updated this revision to Diff 159747.
asbirlea added a comment.

Updated to invalidate topmost loop.
Added test, courtesy of Mikael Holmén.


Repository:
  rL LLVM

https://reviews.llvm.org/D50422

Files:
  lib/Transforms/Scalar/LoopSimplifyCFG.cpp
  test/Transforms/LoopIdiom/scev-invalidation_topmostloop.ll


Index: test/Transforms/LoopIdiom/scev-invalidation_topmostloop.ll
===================================================================
--- /dev/null
+++ test/Transforms/LoopIdiom/scev-invalidation_topmostloop.ll
@@ -0,0 +1,23 @@
+; RUN: opt -S -indvars -loop-idiom -verify -loop-simplifycfg -loop-idiom < %s
+
+target triple = "x86_64-unknown-linux-gnu"
+
+define void @f1() {
+entry:
+  br label %lbl1
+
+lbl1:                                             ; preds = %if.end, %entry
+  br label %for
+
+for:                                              ; preds = %if.end, %lbl1
+  br label %lor.end
+
+lor.end:                                          ; preds = %for
+  br i1 undef, label %for.end, label %if.end
+
+if.end:                                           ; preds = %lor.end
+  br i1 undef, label %lbl1, label %for
+
+for.end:                                          ; preds = %lor.end
+  ret void
+}
Index: lib/Transforms/Scalar/LoopSimplifyCFG.cpp
===================================================================
--- lib/Transforms/Scalar/LoopSimplifyCFG.cpp
+++ lib/Transforms/Scalar/LoopSimplifyCFG.cpp
@@ -61,7 +61,8 @@
     // Merge Succ into Pred and delete it.
     MergeBlockIntoPredecessor(Succ, &DTU, &LI);
 
-    SE.forgetLoop(&L);
+    SE.forgetTopmostLoop(&L);
+
     Changed = true;
   }
 


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


More information about the llvm-commits mailing list