Dale Johannesen | 14e545d | 2009-08-06 22:56:40 +0000 | [diff] [blame] | 1 | ; RUN: llvm-as < %s | llc -O3 |
| 2 | ; PR4626 |
| 3 | ; ModuleID = '<stdin>' |
| 4 | target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:32:32" |
| 5 | target triple = "i386-pc-linux-gnu" |
| 6 | @g_3 = common global i8 0, align 1 ; <i8*> [#uses=2] |
| 7 | |
| 8 | define signext i8 @safe_mul_func_int16_t_s_s(i32 %_si1, i8 signext %_si2) nounwind readnone { |
| 9 | entry: |
| 10 | %tobool = icmp eq i32 %_si1, 0 ; <i1> [#uses=1] |
| 11 | %cmp = icmp sgt i8 %_si2, 0 ; <i1> [#uses=2] |
| 12 | %or.cond = or i1 %cmp, %tobool ; <i1> [#uses=1] |
| 13 | br i1 %or.cond, label %lor.rhs, label %land.lhs.true3 |
| 14 | |
| 15 | land.lhs.true3: ; preds = %entry |
| 16 | %conv5 = sext i8 %_si2 to i32 ; <i32> [#uses=1] |
| 17 | %cmp7 = icmp slt i32 %conv5, %_si1 ; <i1> [#uses=1] |
| 18 | br i1 %cmp7, label %cond.end, label %lor.rhs |
| 19 | |
| 20 | lor.rhs: ; preds = %land.lhs.true3, %entry |
| 21 | %cmp10.not = icmp slt i32 %_si1, 1 ; <i1> [#uses=1] |
| 22 | %or.cond23 = and i1 %cmp, %cmp10.not ; <i1> [#uses=1] |
| 23 | br i1 %or.cond23, label %lor.end, label %cond.false |
| 24 | |
| 25 | lor.end: ; preds = %lor.rhs |
| 26 | %tobool19 = icmp ne i8 %_si2, 0 ; <i1> [#uses=2] |
| 27 | %lor.ext = zext i1 %tobool19 to i32 ; <i32> [#uses=1] |
| 28 | br i1 %tobool19, label %cond.end, label %cond.false |
| 29 | |
| 30 | cond.false: ; preds = %lor.end, %lor.rhs |
| 31 | %conv21 = sext i8 %_si2 to i32 ; <i32> [#uses=1] |
| 32 | br label %cond.end |
| 33 | |
| 34 | cond.end: ; preds = %cond.false, %lor.end, %land.lhs.true3 |
| 35 | %cond = phi i32 [ %conv21, %cond.false ], [ 1, %land.lhs.true3 ], [ %lor.ext, %lor.end ] ; <i32> [#uses=1] |
| 36 | %conv22 = trunc i32 %cond to i8 ; <i8> [#uses=1] |
| 37 | ret i8 %conv22 |
| 38 | } |
| 39 | |
| 40 | define i32 @func_34(i8 signext %p_35) nounwind readonly { |
| 41 | entry: |
| 42 | %tobool = icmp eq i8 %p_35, 0 ; <i1> [#uses=1] |
| 43 | br i1 %tobool, label %lor.lhs.false, label %if.then |
| 44 | |
| 45 | lor.lhs.false: ; preds = %entry |
| 46 | %tmp1 = load i8* @g_3 ; <i8> [#uses=1] |
| 47 | %tobool3 = icmp eq i8 %tmp1, 0 ; <i1> [#uses=1] |
| 48 | br i1 %tobool3, label %return, label %if.then |
| 49 | |
| 50 | if.then: ; preds = %lor.lhs.false, %entry |
| 51 | %tmp4 = load i8* @g_3 ; <i8> [#uses=1] |
| 52 | %conv5 = sext i8 %tmp4 to i32 ; <i32> [#uses=1] |
| 53 | ret i32 %conv5 |
| 54 | |
| 55 | return: ; preds = %lor.lhs.false |
| 56 | ret i32 0 |
| 57 | } |
| 58 | |
| 59 | define void @foo(i32 %p_5) noreturn nounwind { |
| 60 | entry: |
| 61 | %cmp = icmp sgt i32 %p_5, 0 ; <i1> [#uses=2] |
| 62 | %call = tail call i32 @safe() nounwind ; <i32> [#uses=1] |
| 63 | %conv1 = trunc i32 %call to i8 ; <i8> [#uses=3] |
| 64 | %tobool.i = xor i1 %cmp, true ; <i1> [#uses=3] |
| 65 | %cmp.i = icmp sgt i8 %conv1, 0 ; <i1> [#uses=3] |
| 66 | %or.cond.i = or i1 %cmp.i, %tobool.i ; <i1> [#uses=1] |
| 67 | br i1 %or.cond.i, label %lor.rhs.i, label %land.lhs.true3.i |
| 68 | |
| 69 | land.lhs.true3.i: ; preds = %entry |
| 70 | %xor = zext i1 %cmp to i32 ; <i32> [#uses=1] |
| 71 | %conv5.i = sext i8 %conv1 to i32 ; <i32> [#uses=1] |
| 72 | %cmp7.i = icmp slt i32 %conv5.i, %xor ; <i1> [#uses=1] |
| 73 | %cmp7.i.not = xor i1 %cmp7.i, true ; <i1> [#uses=1] |
| 74 | %or.cond23.i = and i1 %cmp.i, %tobool.i ; <i1> [#uses=1] |
| 75 | %or.cond = and i1 %cmp7.i.not, %or.cond23.i ; <i1> [#uses=1] |
| 76 | br i1 %or.cond, label %lor.end.i, label %for.inc |
| 77 | |
| 78 | lor.rhs.i: ; preds = %entry |
| 79 | %or.cond23.i.old = and i1 %cmp.i, %tobool.i ; <i1> [#uses=1] |
| 80 | br i1 %or.cond23.i.old, label %lor.end.i, label %for.inc |
| 81 | |
| 82 | lor.end.i: ; preds = %lor.rhs.i, %land.lhs.true3.i |
| 83 | %tobool19.i = icmp eq i8 %conv1, 0 ; <i1> [#uses=0] |
| 84 | br label %for.inc |
| 85 | |
| 86 | for.inc: ; preds = %for.inc, %lor.end.i, %lor.rhs.i, %land.lhs.true3.i |
| 87 | br label %for.inc |
| 88 | } |
| 89 | |
| 90 | declare i32 @safe() |
Dan Gohman | da65822 | 2009-08-18 15:18:18 +0000 | [diff] [blame^] | 91 | |
| 92 | define i32 @func_35(i8 signext %p_35) nounwind readonly { |
| 93 | entry: |
| 94 | %tobool = icmp eq i8 %p_35, 0 ; <i1> [#uses=1] |
| 95 | br i1 %tobool, label %lor.lhs.false, label %if.then |
| 96 | |
| 97 | lor.lhs.false: ; preds = %entry |
| 98 | %tmp1 = load i8* @g_3 ; <i8> [#uses=1] |
| 99 | %tobool3 = icmp eq i8 %tmp1, 0 ; <i1> [#uses=1] |
| 100 | br i1 %tobool3, label %return, label %if.then |
| 101 | |
| 102 | if.then: ; preds = %lor.lhs.false, %entry |
| 103 | %tmp4 = load i8* @g_3 ; <i8> [#uses=1] |
| 104 | %conv5 = sext i8 %tmp4 to i32 ; <i32> [#uses=1] |
| 105 | ret i32 %conv5 |
| 106 | |
| 107 | return: ; preds = %lor.lhs.false |
| 108 | ret i32 0 |
| 109 | } |
| 110 | |
| 111 | define void @bar(i32 %p_5) noreturn nounwind { |
| 112 | entry: |
| 113 | %cmp = icmp sgt i32 %p_5, 0 ; <i1> [#uses=2] |
| 114 | %call = tail call i32 @safe() nounwind ; <i32> [#uses=1] |
| 115 | %conv1 = trunc i32 %call to i8 ; <i8> [#uses=3] |
| 116 | %tobool.i = xor i1 %cmp, true ; <i1> [#uses=3] |
| 117 | %cmp.i = icmp sgt i8 %conv1, 0 ; <i1> [#uses=3] |
| 118 | %or.cond.i = or i1 %cmp.i, %tobool.i ; <i1> [#uses=1] |
| 119 | br i1 %or.cond.i, label %lor.rhs.i, label %land.lhs.true3.i |
| 120 | |
| 121 | land.lhs.true3.i: ; preds = %entry |
| 122 | %xor = zext i1 %cmp to i32 ; <i32> [#uses=1] |
| 123 | %conv5.i = sext i8 %conv1 to i32 ; <i32> [#uses=1] |
| 124 | %cmp7.i = icmp slt i32 %conv5.i, %xor ; <i1> [#uses=1] |
| 125 | %cmp7.i.not = xor i1 %cmp7.i, true ; <i1> [#uses=1] |
| 126 | %or.cond23.i = and i1 %cmp.i, %tobool.i ; <i1> [#uses=1] |
| 127 | %or.cond = and i1 %cmp7.i.not, %or.cond23.i ; <i1> [#uses=1] |
| 128 | br i1 %or.cond, label %lor.end.i, label %for.inc |
| 129 | |
| 130 | lor.rhs.i: ; preds = %entry |
| 131 | %or.cond23.i.old = and i1 %cmp.i, %tobool.i ; <i1> [#uses=1] |
| 132 | br i1 %or.cond23.i.old, label %lor.end.i, label %for.inc |
| 133 | |
| 134 | lor.end.i: ; preds = %lor.rhs.i, %land.lhs.true3.i |
| 135 | %tobool19.i = icmp eq i8 %conv1, 0 ; <i1> [#uses=0] |
| 136 | br label %for.inc |
| 137 | |
| 138 | for.inc: ; preds = %for.inc, %lor.end.i, %lor.rhs.i, %land.lhs.true3.i |
| 139 | br label %for.inc |
| 140 | } |
| 141 | |
| 142 | declare i32 @safe() |