diff options
author | Jatin Bhateja <jatin.bhateja@gmail.com> | 2017-10-18 01:36:16 +0000 |
---|---|---|
committer | Jatin Bhateja <jatin.bhateja@gmail.com> | 2017-10-18 01:36:16 +0000 |
commit | b8354dd5d80607e361bdcb57a23aba5d7627cca3 (patch) | |
tree | 4dbb5533e56fe2cd4209dc358367c1c4871b30ad /test/Analysis | |
parent | 2b488868304f462bacfcf9d460de4c03d463dd69 (diff) |
[ScalarEvolution] Handling for ICmp occuring in the evolution chain.
Summary:
If a compare instruction is same or inverse of the compare in the
branch of the loop latch, then return a constant evolution node.
Currently scope of evaluation is limited to SCEV computation for
PHI nodes.
This shall facilitate computations of loop exit counts in cases
where compare appears in the evolution chain of induction variables.
Will fix PR 34538
Reviewers: sanjoy, hfinkel, junryoungju
Reviewed By: junryoungju
Subscribers: javed.absar, llvm-commits
Differential Revision: https://reviews.llvm.org/D38494
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@316054 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/Analysis')
-rw-r--r-- | test/Analysis/ScalarEvolution/pr34538.ll | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/test/Analysis/ScalarEvolution/pr34538.ll b/test/Analysis/ScalarEvolution/pr34538.ll new file mode 100644 index 00000000000..0aa72c36de4 --- /dev/null +++ b/test/Analysis/ScalarEvolution/pr34538.ll @@ -0,0 +1,19 @@ +; RUN: opt -S -scalar-evolution -loop-deletion -simplifycfg -analyze < %s | FileCheck %s --check-prefix=CHECK-ANALYSIS + +define i32 @foo() local_unnamed_addr #0 { +; CHECK-ANALYSIS: Loop %do.body: backedge-taken count is 10000 +; CHECK-ANALYSIS: Loop %do.body: max backedge-taken count is 10000 +; CHECK-ANALYSIS: Loop %do.body: Predicated backedge-taken count is 10000 +entry: + br label %do.body + +do.body: ; preds = %do.body, %entry + %start.0 = phi i32 [ 0, %entry ], [ %inc.start.0, %do.body ] + %cmp = icmp slt i32 %start.0, 10000 + %inc = zext i1 %cmp to i32 + %inc.start.0 = add nsw i32 %start.0, %inc + br i1 %cmp, label %do.body, label %do.end + +do.end: ; preds = %do.body + ret i32 0 +} |