Teach ConstantFolding to do a better job when folding gep(bitcast).
[oota-llvm.git] / test / Transforms / LoopIndexSplit / 2008-09-20-Crash.ll
1 ; RUN: opt < %s -loop-index-split -disable-output
2 ; PR 2805
3 @g_330 = common global i32 0            ; <i32*> [#uses=1]
4
5 define i32 @func_45(i32 %p_47) nounwind {
6 entry:
7         br label %bb
8
9 bb:             ; preds = %bb3, %entry
10         %p_47_addr.0.reg2mem.0 = phi i32 [ 0, %entry ], [ %2, %bb3 ]            ; <i32> [#uses=2]
11         %0 = icmp eq i32 %p_47_addr.0.reg2mem.0, 0              ; <i1> [#uses=1]
12         br i1 %0, label %bb2, label %bb1
13
14 bb1:            ; preds = %bb
15         %1 = tail call i32 (...)* @func_70( i32 1 ) nounwind            ; <i32> [#uses=0]
16         br label %bb3
17
18 bb2:            ; preds = %bb
19         store i32 1, i32* @g_330, align 4
20         br label %bb3
21
22 bb3:            ; preds = %bb2, %bb1
23         %2 = add i32 %p_47_addr.0.reg2mem.0, 1          ; <i32> [#uses=3]
24         %3 = icmp ult i32 %2, 22                ; <i1> [#uses=1]
25         br i1 %3, label %bb, label %bb6
26
27 bb6:            ; preds = %bb3
28         %.lcssa = phi i32 [ %2, %bb3 ]          ; <i32> [#uses=1]
29         %4 = tail call i32 (...)* @func_95( i32 %.lcssa ) nounwind              ; <i32> [#uses=1]
30         %5 = tail call i32 (...)* @func_56( i32 %4 ) nounwind           ; <i32> [#uses=0]
31         ret i32 undef
32 }
33
34 declare i32 @func_70(...)
35
36 declare i32 @func_95(...)
37
38 declare i32 @func_56(...)