a25fa0c37d4840171b1ff8423907060239158187
[oota-llvm.git] / test / Transforms / InstCombine / setcc-cast-cast.ll
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: llvm-upgrade < %s | llvm-as | llc -instcombine | llvm-dis | not grep 'br bool false'
5 int %bug(ubyte %inbuff) {
6 entry:
7         %tmp = bitcast ubyte %inbuff to sbyte   ; <sbyte> [#uses=1]
8         %tmp = sext sbyte %tmp to int           ; <int> [#uses=3]
9         %tmp = seteq int %tmp, 1                ; <bool> [#uses=1]
10         br bool %tmp, label %cond_true, label %cond_next
11
12 cond_true:              ; preds = %entry
13         br label %bb
14
15 cond_next:              ; preds = %entry
16         %tmp3 = seteq int %tmp, -1              ; <bool> [#uses=1]
17         br bool %tmp3, label %cond_true4, label %cond_next5
18
19 cond_true4:             ; preds = %cond_next
20         br label %bb
21
22 cond_next5:             ; preds = %cond_next
23         %tmp7 = setgt int %tmp, 1               ; <bool> [#uses=1]
24         br bool %tmp7, label %cond_true8, label %cond_false
25
26 cond_true8:             ; preds = %cond_next5
27         br label %cond_next9
28
29 cond_false:             ; preds = %cond_next5
30         br label %cond_next9
31
32 cond_next9:             ; preds = %cond_false, %cond_true8
33         %iftmp.1.0 = phi int [ 42, %cond_true8 ], [ 23, %cond_false ]           ; <int> [#uses=1]
34         br label %return
35
36 bb:             ; preds = %cond_true4, %cond_true
37         br label %return
38
39 return:         ; preds = %bb, %cond_next9
40         %retval.0 = phi int [ 17, %bb ], [ %iftmp.1.0, %cond_next9 ]            ; <int> [#uses=1]
41         ret int %retval.0
42 }