[llvm] r339363 - SCEV should forget all loops containing a deleted block.
Alina Sbirlea via llvm-commits
llvm-commits at lists.llvm.org
Thu Aug 9 10:53:26 PDT 2018
Author: asbirlea
Date: Thu Aug 9 10:53:26 2018
New Revision: 339363
URL: http://llvm.org/viewvc/llvm-project?rev=339363&view=rev
Log:
SCEV should forget all loops containing a deleted block.
Summary:
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 topmost loop.
Reviewers: greened, mkazantsev, sanjoy
Subscribers: jlebar, javed.absar, uabelho, llvm-commits
Differential Revision: https://reviews.llvm.org/D50422
Added:
llvm/trunk/test/Transforms/LoopIdiom/scev-invalidation_topmostloop.ll
Modified:
llvm/trunk/lib/Transforms/Scalar/LoopSimplifyCFG.cpp
Modified: llvm/trunk/lib/Transforms/Scalar/LoopSimplifyCFG.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/LoopSimplifyCFG.cpp?rev=339363&r1=339362&r2=339363&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/Scalar/LoopSimplifyCFG.cpp (original)
+++ llvm/trunk/lib/Transforms/Scalar/LoopSimplifyCFG.cpp Thu Aug 9 10:53:26 2018
@@ -61,7 +61,8 @@ static bool simplifyLoopCFG(Loop &L, Dom
// Merge Succ into Pred and delete it.
MergeBlockIntoPredecessor(Succ, &DTU, &LI);
- SE.forgetLoop(&L);
+ SE.forgetTopmostLoop(&L);
+
Changed = true;
}
Added: llvm/trunk/test/Transforms/LoopIdiom/scev-invalidation_topmostloop.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/LoopIdiom/scev-invalidation_topmostloop.ll?rev=339363&view=auto
==============================================================================
--- llvm/trunk/test/Transforms/LoopIdiom/scev-invalidation_topmostloop.ll (added)
+++ llvm/trunk/test/Transforms/LoopIdiom/scev-invalidation_topmostloop.ll Thu Aug 9 10:53:26 2018
@@ -0,0 +1,25 @@
+; RUN: opt -S -indvars -loop-idiom -verify -loop-simplifycfg -loop-idiom < %s | FileCheck %s
+
+target triple = "x86_64-unknown-linux-gnu"
+
+; CHECK-LABEL: @f1()
+; CHECK-NEXT: entry:
+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
+}
More information about the llvm-commits
mailing list