blob: c4678b47ac40e635c39db40c129da7830f83f7bc [file] [log] [blame]
Devang Patel52abbf52008-05-19 22:23:55 +00001; RUN: llvm-as < %s | opt -loop-index-split | llvm-dis | grep tmp8 | count 3
2; count 3 = increment + phi + store
3;PR2294
4@g_2 = external global i16 ; <i16*> [#uses=4]
5@g_5 = external global i32 ; <i32*> [#uses=1]
6@.str = external constant [4 x i8] ; <[4 x i8]*> [#uses=1]
7
8declare void @func_1() nounwind
9
10define i32 @main() nounwind {
11entry:
12 %tmp101.i = load i16* @g_2, align 2 ; <i16> [#uses=1]
13 %tmp112.i = icmp sgt i16 %tmp101.i, 0 ; <i1> [#uses=1]
14 br i1 %tmp112.i, label %bb.preheader.i, label %func_1.exit
15bb.preheader.i: ; preds = %entry
16 %g_2.promoted.i = load i16* @g_2 ; <i16> [#uses=1]
17 br label %bb.i
18bb.i: ; preds = %bb6.i, %bb.preheader.i
19 %g_2.tmp.0.i = phi i16 [ %g_2.promoted.i, %bb.preheader.i ], [ %tmp8.i, %bb6.i ] ; <i16> [#uses=2]
20 %tmp2.i = icmp eq i16 %g_2.tmp.0.i, 0 ; <i1> [#uses=1]
21 br i1 %tmp2.i, label %bb4.i, label %bb6.i
22bb4.i: ; preds = %bb.i
23 %tmp5.i = volatile load i32* @g_5, align 4 ; <i32> [#uses=0]
24 br label %bb6.i
25bb6.i: ; preds = %bb4.i, %bb.i
26 %tmp8.i = add i16 %g_2.tmp.0.i, 1 ; <i16> [#uses=3]
Devang Patela5e27f82008-07-09 00:12:01 +000027 %tmp11.i = icmp sgt i16 %tmp8.i, 42 ; <i1> [#uses=1]
Devang Patel52abbf52008-05-19 22:23:55 +000028 br i1 %tmp11.i, label %bb.i, label %return.loopexit.i
29return.loopexit.i: ; preds = %bb6.i
30 %tmp8.i.lcssa = phi i16 [ %tmp8.i, %bb6.i ] ; <i16> [#uses=1]
31 store i16 %tmp8.i.lcssa, i16* @g_2
32 br label %func_1.exit
33func_1.exit: ; preds = %return.loopexit.i, %entry
34 %tmp1 = load i16* @g_2, align 2 ; <i16> [#uses=1]
35 %tmp12 = sext i16 %tmp1 to i32 ; <i32> [#uses=1]
36 %tmp3 = tail call i32 (i8*, ...)* @printf( i8* getelementptr ([4 x i8]* @.str, i32 0, i32 0), i32 %tmp12 ) nounwind ; <i32> [#uses=0]
37 ret i32 0
38}
39
40declare i32 @printf(i8*, ...) nounwind
41