Reid Spencer | 6c38f0b | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 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. |
Reid Spencer | 91948d4 | 2007-04-14 20:13:02 +0000 | [diff] [blame] | 4 | ; RUN: llvm-upgrade < %s | llvm-as | opt -instcombine | llvm-dis | \ |
| 5 | ; RUN: not grep {br bool false} |
| 6 | ; END. |
| 7 | |
Reid Spencer | 6c38f0b | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 8 | int %bug(ubyte %inbuff) { |
| 9 | entry: |
| 10 | %tmp = bitcast ubyte %inbuff to sbyte ; <sbyte> [#uses=1] |
| 11 | %tmp = sext sbyte %tmp to int ; <int> [#uses=3] |
| 12 | %tmp = seteq int %tmp, 1 ; <bool> [#uses=1] |
| 13 | br bool %tmp, label %cond_true, label %cond_next |
| 14 | |
| 15 | cond_true: ; preds = %entry |
| 16 | br label %bb |
| 17 | |
| 18 | cond_next: ; preds = %entry |
| 19 | %tmp3 = seteq int %tmp, -1 ; <bool> [#uses=1] |
| 20 | br bool %tmp3, label %cond_true4, label %cond_next5 |
| 21 | |
| 22 | cond_true4: ; preds = %cond_next |
| 23 | br label %bb |
| 24 | |
| 25 | cond_next5: ; preds = %cond_next |
| 26 | %tmp7 = setgt int %tmp, 1 ; <bool> [#uses=1] |
| 27 | br bool %tmp7, label %cond_true8, label %cond_false |
| 28 | |
| 29 | cond_true8: ; preds = %cond_next5 |
| 30 | br label %cond_next9 |
| 31 | |
| 32 | cond_false: ; preds = %cond_next5 |
| 33 | br label %cond_next9 |
| 34 | |
| 35 | cond_next9: ; preds = %cond_false, %cond_true8 |
| 36 | %iftmp.1.0 = phi int [ 42, %cond_true8 ], [ 23, %cond_false ] ; <int> [#uses=1] |
| 37 | br label %return |
| 38 | |
| 39 | bb: ; preds = %cond_true4, %cond_true |
| 40 | br label %return |
| 41 | |
| 42 | return: ; preds = %bb, %cond_next9 |
| 43 | %retval.0 = phi int [ 17, %bb ], [ %iftmp.1.0, %cond_next9 ] ; <int> [#uses=1] |
| 44 | ret int %retval.0 |
| 45 | } |