diff options
author | Eli Friedman <eli.friedman@gmail.com> | 2009-05-09 12:32:42 +0000 |
---|---|---|
committer | Eli Friedman <eli.friedman@gmail.com> | 2009-05-09 12:32:42 +0000 |
commit | 361e54d433e67db5d6b6455f7fd098de8c01f882 (patch) | |
tree | 9a651fda61ff46e13b4c756dc35b6c4bffd31bd6 /test/Analysis | |
parent | cea03cdb6946841a951f6c622b117459ea5ca157 (diff) | |
download | external_llvm-361e54d433e67db5d6b6455f7fd098de8c01f882.zip external_llvm-361e54d433e67db5d6b6455f7fd098de8c01f882.tar.gz external_llvm-361e54d433e67db5d6b6455f7fd098de8c01f882.tar.bz2 |
Allow scalar evolution to compute iteration counts for loops with a
pointer-based condition. This fixes PR3171.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@71354 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/Analysis')
-rw-r--r-- | test/Analysis/ScalarEvolution/2009-05-09-PointerEdgeCount.ll | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/test/Analysis/ScalarEvolution/2009-05-09-PointerEdgeCount.ll b/test/Analysis/ScalarEvolution/2009-05-09-PointerEdgeCount.ll new file mode 100644 index 0000000..bea46a7 --- /dev/null +++ b/test/Analysis/ScalarEvolution/2009-05-09-PointerEdgeCount.ll @@ -0,0 +1,27 @@ +; RUN: llvm-as < %s | opt -analyze -scalar-evolution | grep {count is 2} +; PR3171 + + %struct.Foo = type { i32 } + %struct.NonPod = type { [2 x %struct.Foo] } + +define void @_Z3foov() nounwind { +entry: + %x = alloca %struct.NonPod, align 8 ; <%struct.NonPod*> [#uses=2] + %0 = getelementptr %struct.NonPod* %x, i32 0, i32 0 ; <[2 x %struct.Foo]*> [#uses=1] + %1 = getelementptr [2 x %struct.Foo]* %0, i32 1, i32 0 ; <%struct.Foo*> [#uses=1] + br label %bb1.i + +bb1.i: ; preds = %bb2.i, %entry + %.0.i = phi %struct.Foo* [ %1, %entry ], [ %4, %bb2.i ] ; <%struct.Foo*> [#uses=2] + %2 = getelementptr %struct.NonPod* %x, i32 0, i32 0, i32 0 ; <%struct.Foo*> [#uses=1] + %3 = icmp eq %struct.Foo* %.0.i, %2 ; <i1> [#uses=1] + br i1 %3, label %_ZN6NonPodD1Ev.exit, label %bb2.i + +bb2.i: ; preds = %bb1.i + %4 = getelementptr %struct.Foo* %.0.i, i32 -1 ; <%struct.Foo*> [#uses=1] + br label %bb1.i + +_ZN6NonPodD1Ev.exit: ; preds = %bb1.i + ret void +} + |