diff options
| author | Wei Mi <wmi@google.com> | 2016-08-09 20:40:03 +0000 |
|---|---|---|
| committer | Wei Mi <wmi@google.com> | 2016-08-09 20:40:03 +0000 |
| commit | 575435012ca30f3064d539baf9a920c9f3fdd82d (patch) | |
| tree | d6f851d28df682f78e605362ffd7f57489e8a76b /llvm/test/Analysis/ScalarEvolution/pr28705.ll | |
| parent | 785858cf6c6f1716bab78940769de982cdb5f2e5 (diff) | |
| download | bcm5719-llvm-575435012ca30f3064d539baf9a920c9f3fdd82d.tar.gz bcm5719-llvm-575435012ca30f3064d539baf9a920c9f3fdd82d.zip | |
Fix the runtime error caused by "Use ValueOffsetPair to enhance value reuse during SCEV expansion".
The patch is to fix the bug in PR28705. It was caused by setting wrong return
value for SCEVExpander::findExistingExpansion. The return values of findExistingExpansion
have different meanings when the function is used in different ways so it is easy to make
mistake. The fix creates two new interfaces to replace SCEVExpander::findExistingExpansion,
and specifies where each interface is expected to be used.
Differential Revision: https://reviews.llvm.org/D22942
llvm-svn: 278161
Diffstat (limited to 'llvm/test/Analysis/ScalarEvolution/pr28705.ll')
| -rw-r--r-- | llvm/test/Analysis/ScalarEvolution/pr28705.ll | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/llvm/test/Analysis/ScalarEvolution/pr28705.ll b/llvm/test/Analysis/ScalarEvolution/pr28705.ll new file mode 100644 index 00000000000..8fbc08e3ca6 --- /dev/null +++ b/llvm/test/Analysis/ScalarEvolution/pr28705.ll @@ -0,0 +1,41 @@ +; PR28705 +; RUN: opt < %s -indvars -S | FileCheck %s + +; Check IndVarSimplify replaces the exitval use of the induction var "%inc.i.i" +; with "%.sroa.speculated + 1". +; +; CHECK-LABEL: @foo( +; CHECK: %[[EXIT:.+]] = sub i32 %.sroa.speculated, -1 +; CHECK: %DB.sroa.9.0.lcssa = phi i32 [ 1, %entry ], [ %[[EXIT]], %loopexit ] +; +define void @foo(i32 %sub.ptr.div.i, i8* %ref.i1174) local_unnamed_addr { +entry: + %cmp.i1137 = icmp ugt i32 %sub.ptr.div.i, 3 + %.sroa.speculated = select i1 %cmp.i1137, i32 3, i32 %sub.ptr.div.i + %cmp6483126 = icmp eq i32 %.sroa.speculated, 0 + br i1 %cmp6483126, label %XZ.exit, label %for.body650.lr.ph + +for.body650.lr.ph: + br label %for.body650 + +loopexit: + %inc.i.i.lcssa = phi i32 [ %inc.i.i, %for.body650 ] + br label %XZ.exit + +XZ.exit: + %DB.sroa.9.0.lcssa = phi i32 [ 1, %entry ], [ %inc.i.i.lcssa, %loopexit ] + br label %end + +for.body650: + %iv = phi i32 [ 0, %for.body650.lr.ph ], [ %inc655, %for.body650 ] + %iv2 = phi i32 [ 1, %for.body650.lr.ph ], [ %inc.i.i, %for.body650 ] + %arrayidx.i.i1105 = getelementptr inbounds i8, i8* %ref.i1174, i32 %iv2 + store i8 7, i8* %arrayidx.i.i1105, align 1 + %inc.i.i = add i32 %iv2, 1 + %inc655 = add i32 %iv, 1 + %cmp648 = icmp eq i32 %inc655, %.sroa.speculated + br i1 %cmp648, label %loopexit, label %for.body650 + +end: + ret void +} |

