From de0f2382e4aa99c921216574ce97f09c3d145d0f Mon Sep 17 00:00:00 2001 From: Wojciech Matyjewicz Date: Sun, 20 Jul 2008 15:55:14 +0000 Subject: Fix PR2088. Use modulo linear equation solver to compute loop iteration count. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53810 91177308-0d34-0410-b5e6-96231b3b80d8 --- .../ScalarEvolution/2008-05-25-NegativeStepToZero.ll | 1 - test/Analysis/ScalarEvolution/2008-07-19-InfiniteLoop.ll | 15 +++++++++++++++ test/Analysis/ScalarEvolution/2008-07-19-WrappingIV.ll | 15 +++++++++++++++ 3 files changed, 30 insertions(+), 1 deletion(-) create mode 100644 test/Analysis/ScalarEvolution/2008-07-19-InfiniteLoop.ll create mode 100644 test/Analysis/ScalarEvolution/2008-07-19-WrappingIV.ll (limited to 'test/Analysis') diff --git a/test/Analysis/ScalarEvolution/2008-05-25-NegativeStepToZero.ll b/test/Analysis/ScalarEvolution/2008-05-25-NegativeStepToZero.ll index cea2a98..228de9e 100644 --- a/test/Analysis/ScalarEvolution/2008-05-25-NegativeStepToZero.ll +++ b/test/Analysis/ScalarEvolution/2008-05-25-NegativeStepToZero.ll @@ -1,7 +1,6 @@ ; RUN: llvm-as < %s | opt -analyze -scalar-evolution \ ; RUN: -scalar-evolution-max-iterations=0 | grep {61 iterations} ; PR2364 -; XFAIL: * define i32 @func_6() nounwind { entry: diff --git a/test/Analysis/ScalarEvolution/2008-07-19-InfiniteLoop.ll b/test/Analysis/ScalarEvolution/2008-07-19-InfiniteLoop.ll new file mode 100644 index 0000000..a3cc600 --- /dev/null +++ b/test/Analysis/ScalarEvolution/2008-07-19-InfiniteLoop.ll @@ -0,0 +1,15 @@ +; RUN: llvm-as < %s | opt -analyze -scalar-evolution \ +; RUN: -scalar-evolution-max-iterations=0 | grep Unpredictable +; PR2088 + +define void @fun() { +entry: + br label %loop +loop: + %i = phi i8 [ 0, %entry ], [ %i.next, %loop ] + %i.next = add i8 %i, 4 + %cond = icmp ne i8 %i.next, 6 + br i1 %cond, label %loop, label %exit +exit: + ret void +} diff --git a/test/Analysis/ScalarEvolution/2008-07-19-WrappingIV.ll b/test/Analysis/ScalarEvolution/2008-07-19-WrappingIV.ll new file mode 100644 index 0000000..ce03db0 --- /dev/null +++ b/test/Analysis/ScalarEvolution/2008-07-19-WrappingIV.ll @@ -0,0 +1,15 @@ +; RUN: llvm-as < %s | opt -analyze -scalar-evolution \ +; RUN: -scalar-evolution-max-iterations=0 | grep {113 iterations} +; PR2088 + +define void @fun() { +entry: + br label %loop +loop: + %i = phi i8 [ 0, %entry ], [ %i.next, %loop ] + %i.next = add i8 %i, 18 + %cond = icmp ne i8 %i.next, 4 + br i1 %cond, label %loop, label %exit +exit: + ret void +} -- cgit v1.1