blob: 90be6803a5c3a8e9f921b0e1b1cf9a6b32d8fcf4 [file] [log] [blame]
Dan Gohman3c7d3082009-09-11 18:01:28 +00001; RUN: opt < %s -simplifycfg -disable-output
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002; PR584
Tanya Lattner003eae52008-03-10 07:21:50 +00003@g_38098584 = external global i32 ; <i32*> [#uses=1]
4@g_60187400 = external global i32 ; <i32*> [#uses=1]
5@g_59182229 = external global i32 ; <i32*> [#uses=2]
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006
Tanya Lattner003eae52008-03-10 07:21:50 +00007define i32 @_Z13func_26556482h(i8 %l_88173906) {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00008entry:
Tanya Lattner003eae52008-03-10 07:21:50 +00009 %tmp.1 = bitcast i8 %l_88173906 to i8 ; <i8> [#uses=2]
10 %tmp.3 = icmp eq i8 %l_88173906, 0 ; <i1> [#uses=1]
11 br i1 %tmp.3, label %else.0, label %then.0
Dan Gohmanf17a25c2007-07-18 16:29:46 +000012then.0: ; preds = %entry
Tanya Lattner003eae52008-03-10 07:21:50 +000013 %tmp.5 = icmp eq i8 %l_88173906, 0 ; <i1> [#uses=1]
14 br i1 %tmp.5, label %else.1, label %then.1
Dan Gohmanf17a25c2007-07-18 16:29:46 +000015then.1: ; preds = %then.0
16 br label %return
Dan Gohmanf17a25c2007-07-18 16:29:46 +000017else.1: ; preds = %then.0
18 br label %loopentry.0
Dan Gohmanf17a25c2007-07-18 16:29:46 +000019loopentry.0: ; preds = %no_exit.0, %else.1
Tanya Lattner003eae52008-03-10 07:21:50 +000020 %i.0.1 = phi i32 [ 0, %else.1 ], [ %inc.0, %no_exit.0 ] ; <i32> [#uses=2]
21 %tmp.9 = icmp sgt i32 %i.0.1, 99 ; <i1> [#uses=1]
22 br i1 %tmp.9, label %endif.0, label %no_exit.0
Dan Gohmanf17a25c2007-07-18 16:29:46 +000023no_exit.0: ; preds = %loopentry.0
Tanya Lattner003eae52008-03-10 07:21:50 +000024 %inc.0 = add i32 %i.0.1, 1 ; <i32> [#uses=1]
Dan Gohmanf17a25c2007-07-18 16:29:46 +000025 br label %loopentry.0
Dan Gohmanf17a25c2007-07-18 16:29:46 +000026else.0: ; preds = %entry
Tanya Lattner003eae52008-03-10 07:21:50 +000027 %tmp.12 = sext i8 %tmp.1 to i32 ; <i32> [#uses=1]
Dan Gohmanf17a25c2007-07-18 16:29:46 +000028 br label %return
Dan Gohmanf17a25c2007-07-18 16:29:46 +000029endif.0: ; preds = %loopentry.0
Tanya Lattner003eae52008-03-10 07:21:50 +000030 %tmp.14 = sext i8 %tmp.1 to i32 ; <i32> [#uses=1]
31 %tmp.16 = zext i8 %l_88173906 to i32 ; <i32> [#uses=1]
32 %tmp.17 = icmp sgt i32 %tmp.14, %tmp.16 ; <i1> [#uses=1]
33 %tmp.19 = load i32* @g_59182229 ; <i32> [#uses=2]
34 br i1 %tmp.17, label %cond_true, label %cond_false
Dan Gohmanf17a25c2007-07-18 16:29:46 +000035cond_true: ; preds = %endif.0
Tanya Lattner003eae52008-03-10 07:21:50 +000036 %tmp.20 = icmp ne i32 %tmp.19, 1 ; <i1> [#uses=1]
Dan Gohmanf17a25c2007-07-18 16:29:46 +000037 br label %cond_continue
Dan Gohmanf17a25c2007-07-18 16:29:46 +000038cond_false: ; preds = %endif.0
Tanya Lattner003eae52008-03-10 07:21:50 +000039 %tmp.22 = icmp ne i32 %tmp.19, 0 ; <i1> [#uses=1]
Dan Gohmanf17a25c2007-07-18 16:29:46 +000040 br label %cond_continue
Dan Gohmanf17a25c2007-07-18 16:29:46 +000041cond_continue: ; preds = %cond_false, %cond_true
Tanya Lattner003eae52008-03-10 07:21:50 +000042 %mem_tmp.0 = phi i1 [ %tmp.20, %cond_true ], [ %tmp.22, %cond_false ] ; <i1> [#uses=1]
43 br i1 %mem_tmp.0, label %then.2, label %else.2
Dan Gohmanf17a25c2007-07-18 16:29:46 +000044then.2: ; preds = %cond_continue
Tanya Lattner003eae52008-03-10 07:21:50 +000045 %tmp.25 = zext i8 %l_88173906 to i32 ; <i32> [#uses=1]
Dan Gohmanf17a25c2007-07-18 16:29:46 +000046 br label %return
Dan Gohmanf17a25c2007-07-18 16:29:46 +000047else.2: ; preds = %cond_continue
48 br label %loopentry.1
Dan Gohmanf17a25c2007-07-18 16:29:46 +000049loopentry.1: ; preds = %endif.3, %else.2
Tanya Lattner003eae52008-03-10 07:21:50 +000050 %i.1.1 = phi i32 [ 0, %else.2 ], [ %inc.3, %endif.3 ] ; <i32> [#uses=2]
51 %i.3.2 = phi i32 [ undef, %else.2 ], [ %i.3.0, %endif.3 ] ; <i32> [#uses=2]
52 %l_88173906_addr.1 = phi i8 [ %l_88173906, %else.2 ], [ %l_88173906_addr.0, %endif.3 ] ; <i8> [#uses=3]
53 %tmp.29 = icmp sgt i32 %i.1.1, 99 ; <i1> [#uses=1]
54 br i1 %tmp.29, label %endif.2, label %no_exit.1
Dan Gohmanf17a25c2007-07-18 16:29:46 +000055no_exit.1: ; preds = %loopentry.1
Tanya Lattner003eae52008-03-10 07:21:50 +000056 %tmp.30 = load i32* @g_38098584 ; <i32> [#uses=1]
57 %tmp.31 = icmp eq i32 %tmp.30, 0 ; <i1> [#uses=1]
58 br i1 %tmp.31, label %else.3, label %then.3
Dan Gohmanf17a25c2007-07-18 16:29:46 +000059then.3: ; preds = %no_exit.1
60 br label %endif.3
Dan Gohmanf17a25c2007-07-18 16:29:46 +000061else.3: ; preds = %no_exit.1
Tanya Lattner003eae52008-03-10 07:21:50 +000062 br i1 false, label %else.4, label %then.4
Dan Gohmanf17a25c2007-07-18 16:29:46 +000063then.4: ; preds = %else.3
64 br label %endif.3
Dan Gohmanf17a25c2007-07-18 16:29:46 +000065else.4: ; preds = %else.3
Tanya Lattner003eae52008-03-10 07:21:50 +000066 br i1 false, label %else.5, label %then.5
Dan Gohmanf17a25c2007-07-18 16:29:46 +000067then.5: ; preds = %else.4
Tanya Lattner003eae52008-03-10 07:21:50 +000068 store i32 -1004318825, i32* @g_59182229
Dan Gohmanf17a25c2007-07-18 16:29:46 +000069 br label %return
Dan Gohmanf17a25c2007-07-18 16:29:46 +000070else.5: ; preds = %else.4
71 br label %loopentry.3
Dan Gohmanf17a25c2007-07-18 16:29:46 +000072loopentry.3: ; preds = %then.7, %else.5
Tanya Lattner003eae52008-03-10 07:21:50 +000073 %i.3.3 = phi i32 [ 0, %else.5 ], [ %inc.2, %then.7 ] ; <i32> [#uses=3]
74 %tmp.55 = icmp sgt i32 %i.3.3, 99 ; <i1> [#uses=1]
75 br i1 %tmp.55, label %endif.3, label %no_exit.3
Dan Gohmanf17a25c2007-07-18 16:29:46 +000076no_exit.3: ; preds = %loopentry.3
Tanya Lattner003eae52008-03-10 07:21:50 +000077 %tmp.57 = icmp eq i8 %l_88173906_addr.1, 0 ; <i1> [#uses=1]
78 br i1 %tmp.57, label %else.7, label %then.7
Dan Gohmanf17a25c2007-07-18 16:29:46 +000079then.7: ; preds = %no_exit.3
Tanya Lattner003eae52008-03-10 07:21:50 +000080 store i32 16239, i32* @g_60187400
81 %inc.2 = add i32 %i.3.3, 1 ; <i32> [#uses=1]
Dan Gohmanf17a25c2007-07-18 16:29:46 +000082 br label %loopentry.3
Dan Gohmanf17a25c2007-07-18 16:29:46 +000083else.7: ; preds = %no_exit.3
84 br label %return
Dan Gohmanf17a25c2007-07-18 16:29:46 +000085endif.3: ; preds = %loopentry.3, %then.4, %then.3
Tanya Lattner003eae52008-03-10 07:21:50 +000086 %i.3.0 = phi i32 [ %i.3.2, %then.3 ], [ %i.3.2, %then.4 ], [ %i.3.3, %loopentry.3 ] ; <i32> [#uses=1]
87 %l_88173906_addr.0 = phi i8 [ 100, %then.3 ], [ %l_88173906_addr.1, %then.4 ], [ %l_88173906_addr.1, %loopentry.3 ] ; <i8> [#uses=1]
88 %inc.3 = add i32 %i.1.1, 1 ; <i32> [#uses=1]
Dan Gohmanf17a25c2007-07-18 16:29:46 +000089 br label %loopentry.1
Dan Gohmanf17a25c2007-07-18 16:29:46 +000090endif.2: ; preds = %loopentry.1
91 br label %return
Dan Gohmanf17a25c2007-07-18 16:29:46 +000092return: ; preds = %endif.2, %else.7, %then.5, %then.2, %else.0, %then.1
Tanya Lattner003eae52008-03-10 07:21:50 +000093 %result.0 = phi i32 [ 1624650671, %then.1 ], [ %tmp.25, %then.2 ], [ 3379, %then.5 ], [ 52410, %else.7 ], [ -1526438411, %endif.2 ], [ %tmp.12, %else.0 ] ; <i32> [#uses=1]
94 ret i32 %result.0
Dan Gohmanf17a25c2007-07-18 16:29:46 +000095}