blob: 9e79f483d9f3868f868fe590c735320b733b9e1f [file] [log] [blame]
Devang Patel4cebc342007-09-10 18:33:42 +00001; RUN: llvm-as < %s | opt -loop-index-split -disable-output
2
3@k = external global i32 ; <i32*> [#uses=2]
4
5define void @foobar(i32 %a, i32 %b) {
6entry:
7 br label %bb
8
9bb: ; preds = %cond_next16, %entry
10 %i.01.0 = phi i32 [ 0, %entry ], [ %tmp18, %cond_next16 ] ; <i32> [#uses=5]
11 %tsum.18.0 = phi i32 [ 42, %entry ], [ %tsum.013.1, %cond_next16 ] ; <i32> [#uses=3]
12 %tmp1 = icmp slt i32 %i.01.0, 50 ; <i1> [#uses=1]
13 br i1 %tmp1, label %cond_true, label %cond_false
14
15cond_true: ; preds = %bb
16 %tmp4 = tail call i32 @foo( i32 %i.01.0 ) ; <i32> [#uses=1]
17 %tmp6 = add i32 %tmp4, %tsum.18.0 ; <i32> [#uses=2]
18 %tmp914 = load i32* @k, align 4 ; <i32> [#uses=1]
19 %tmp1015 = icmp eq i32 %tmp914, 0 ; <i1> [#uses=1]
20 br i1 %tmp1015, label %cond_next16, label %cond_true13
21
22cond_false: ; preds = %bb
23 %tmp8 = tail call i32 @bar( i32 %i.01.0 ) ; <i32> [#uses=0]
24 %tmp9 = load i32* @k, align 4 ; <i32> [#uses=1]
25 %tmp10 = icmp eq i32 %tmp9, 0 ; <i1> [#uses=1]
26 br i1 %tmp10, label %cond_next16, label %cond_true13
27
28cond_true13: ; preds = %cond_false, %cond_true
29 %tsum.013.0 = phi i32 [ %tmp6, %cond_true ], [ %tsum.18.0, %cond_false ] ; <i32> [#uses=1]
30 %tmp15 = tail call i32 @bar( i32 %i.01.0 ) ; <i32> [#uses=0]
31 br label %cond_next16
32
33cond_next16: ; preds = %cond_false, %cond_true, %cond_true13
34 %tsum.013.1 = phi i32 [ %tsum.013.0, %cond_true13 ], [ %tmp6, %cond_true ], [ %tsum.18.0, %cond_false ] ; <i32> [#uses=2]
35 %tmp18 = add i32 %i.01.0, 1 ; <i32> [#uses=3]
36 %tmp21 = icmp eq i32 %tmp18, 100 ; <i1> [#uses=1]
37 br i1 %tmp21, label %bb, label %bb24
38
39bb24: ; preds = %cond_next16
40 %tmp18.lcssa = phi i32 [ %tmp18, %cond_next16 ] ; <i32> [#uses=1]
41 %tsum.013.1.lcssa = phi i32 [ %tsum.013.1, %cond_next16 ] ; <i32> [#uses=1]
42 %tmp27 = tail call i32 @t( i32 %tmp18.lcssa, i32 %tsum.013.1.lcssa ) ; <i32> [#uses=0]
43 ret void
44}
45
46declare i32 @foo(i32)
47
48declare i32 @bar(i32)
49
50declare i32 @t(i32, i32)