diff options
author | Nick Lewycky <nicholas@mxc.ca> | 2007-11-25 22:41:31 +0000 |
---|---|---|
committer | Nick Lewycky <nicholas@mxc.ca> | 2007-11-25 22:41:31 +0000 |
commit | c54c561c9f7270c055dd7ba75a3a003b771a42d9 (patch) | |
tree | 89d177bb9a1e54eae89f8c6a73192dcc9971159d /test | |
parent | cfa597569d79a8b53cc4faa9725a66e246a19866 (diff) |
Add new SCEV, SCEVSMax. This allows LLVM to analyze do-while loops.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44319 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test')
-rw-r--r-- | test/Analysis/ScalarEvolution/do-loop.ll | 18 | ||||
-rw-r--r-- | test/Analysis/ScalarEvolution/smax.ll | 12 | ||||
-rw-r--r-- | test/Transforms/IndVarsSimplify/loop_evaluate_2.ll | 4 |
3 files changed, 32 insertions, 2 deletions
diff --git a/test/Analysis/ScalarEvolution/do-loop.ll b/test/Analysis/ScalarEvolution/do-loop.ll new file mode 100644 index 0000000000..c6b3298638 --- /dev/null +++ b/test/Analysis/ScalarEvolution/do-loop.ll @@ -0,0 +1,18 @@ +; RUN: llvm-as < %s | opt -analyze -scalar-evolution | grep smax +; PR1614 + +define i32 @f(i32 %x, i32 %y) { +entry: + br label %bb + +bb: ; preds = %bb, %entry + %indvar = phi i32 [ 0, %entry ], [ %indvar.next, %bb ] ; <i32> [#uses=2] + %x_addr.0 = add i32 %indvar, %x ; <i32> [#uses=1] + %tmp2 = add i32 %x_addr.0, 1 ; <i32> [#uses=2] + %tmp5 = icmp slt i32 %tmp2, %y ; <i1> [#uses=1] + %indvar.next = add i32 %indvar, 1 ; <i32> [#uses=1] + br i1 %tmp5, label %bb, label %bb7 + +bb7: ; preds = %bb + ret i32 %tmp2 +} diff --git a/test/Analysis/ScalarEvolution/smax.ll b/test/Analysis/ScalarEvolution/smax.ll new file mode 100644 index 0000000000..157d54f3e6 --- /dev/null +++ b/test/Analysis/ScalarEvolution/smax.ll @@ -0,0 +1,12 @@ +; RUN: llvm-as < %s | opt -analyze -scalar-evolution | grep smax | count 2 +; RUN: llvm-as < %s | opt -analyze -scalar-evolution | grep \ +; RUN: "%. smax %. smax %." +; PR1614 + +define i32 @x(i32 %a, i32 %b, i32 %c) { + %A = icmp sgt i32 %a, %b + %B = select i1 %A, i32 %a, i32 %b + %C = icmp sle i32 %c, %B + %D = select i1 %C, i32 %B, i32 %c + ret i32 %D +} diff --git a/test/Transforms/IndVarsSimplify/loop_evaluate_2.ll b/test/Transforms/IndVarsSimplify/loop_evaluate_2.ll index c742691846..635950aed6 100644 --- a/test/Transforms/IndVarsSimplify/loop_evaluate_2.ll +++ b/test/Transforms/IndVarsSimplify/loop_evaluate_2.ll @@ -1,5 +1,5 @@ -; RUN: llvm-as < %s | opt -indvars -adce -simplifycfg | llvm-dis | grep select -; RUN: llvm-as < %s | opt -indvars -adce -simplifycfg | llvm-dis | not grep br +; RUN: llvm-as < %s | opt -indvars -adce -simplifycfg | opt \ +; RUN: -analyze -loops | not grep "^Loop Containing" ; PR1179 define i32 @ltst(i32 %x) { |