1 ; This test case was reduced from MultiSource/Applications/hbd. It makes sure
2 ; that folding doesn't happen in case a zext is applied where a sext should have
3 ; been when a setcc is used with two casts.
4 ; RUN: opt < %s -instcombine -S | \
5 ; RUN: not grep {br i1 false}
8 define i32 @bug(i8 %inbuff) {
10 %tmp = bitcast i8 %inbuff to i8 ; <i8> [#uses=1]
11 %tmp.upgrd.1 = sext i8 %tmp to i32 ; <i32> [#uses=3]
12 %tmp.upgrd.2 = icmp eq i32 %tmp.upgrd.1, 1 ; <i1> [#uses=1]
13 br i1 %tmp.upgrd.2, label %cond_true, label %cond_next
15 cond_true: ; preds = %entry
18 cond_next: ; preds = %entry
19 %tmp3 = icmp eq i32 %tmp.upgrd.1, -1 ; <i1> [#uses=1]
20 br i1 %tmp3, label %cond_true4, label %cond_next5
22 cond_true4: ; preds = %cond_next
25 cond_next5: ; preds = %cond_next
26 %tmp7 = icmp sgt i32 %tmp.upgrd.1, 1 ; <i1> [#uses=1]
27 br i1 %tmp7, label %cond_true8, label %cond_false
29 cond_true8: ; preds = %cond_next5
32 cond_false: ; preds = %cond_next5
35 cond_next9: ; preds = %cond_false, %cond_true8
36 %iftmp.1.0 = phi i32 [ 42, %cond_true8 ], [ 23, %cond_false ] ; <i32> [#uses=1]
39 bb: ; preds = %cond_true4, %cond_true
42 return: ; preds = %bb, %cond_next9
43 %retval.0 = phi i32 [ 17, %bb ], [ %iftmp.1.0, %cond_next9 ] ; <i32> [#uses=1]