blob: 5d1502da179f8788dfc6b1b1b7a4e67798c1d5d7 [file] [log] [blame]
Bill Wendlinga08bb492013-08-22 00:51:19 +00001; RUN: opt < %s -analyze -scalar-evolution | FileCheck %s
Eli Friedmanebf98b02009-05-09 12:32:42 +00002; PR3171
Bill Wendlinga08bb492013-08-22 00:51:19 +00003
4; CHECK: count is 2
5
Kenneth Uildriks90fedc62009-11-03 15:29:06 +00006target datalayout = "E-p:64:64:64-a0:0:8-f32:32:32-f64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-v64:64:64-v128:128:128"
Eli Friedmanebf98b02009-05-09 12:32:42 +00007
8 %struct.Foo = type { i32 }
9 %struct.NonPod = type { [2 x %struct.Foo] }
10
11define void @_Z3foov() nounwind {
12entry:
13 %x = alloca %struct.NonPod, align 8 ; <%struct.NonPod*> [#uses=2]
14 %0 = getelementptr %struct.NonPod* %x, i32 0, i32 0 ; <[2 x %struct.Foo]*> [#uses=1]
15 %1 = getelementptr [2 x %struct.Foo]* %0, i32 1, i32 0 ; <%struct.Foo*> [#uses=1]
16 br label %bb1.i
17
18bb1.i: ; preds = %bb2.i, %entry
19 %.0.i = phi %struct.Foo* [ %1, %entry ], [ %4, %bb2.i ] ; <%struct.Foo*> [#uses=2]
20 %2 = getelementptr %struct.NonPod* %x, i32 0, i32 0, i32 0 ; <%struct.Foo*> [#uses=1]
21 %3 = icmp eq %struct.Foo* %.0.i, %2 ; <i1> [#uses=1]
22 br i1 %3, label %_ZN6NonPodD1Ev.exit, label %bb2.i
23
24bb2.i: ; preds = %bb1.i
25 %4 = getelementptr %struct.Foo* %.0.i, i32 -1 ; <%struct.Foo*> [#uses=1]
26 br label %bb1.i
27
28_ZN6NonPodD1Ev.exit: ; preds = %bb1.i
29 ret void
30}
31