1 ; RUN: llc < %s -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 define i32 @func_35(i8 signext %p_35) nounwind readonly { 91 entry: 92 %tobool = icmp eq i8 %p_35, 0 ; <i1> [#uses=1] 93 br i1 %tobool, label %lor.lhs.false, label %if.then 94 95 lor.lhs.false: ; preds = %entry 96 %tmp1 = load i8* @g_3 ; <i8> [#uses=1] 97 %tobool3 = icmp eq i8 %tmp1, 0 ; <i1> [#uses=1] 98 br i1 %tobool3, label %return, label %if.then 99 100 if.then: ; preds = %lor.lhs.false, %entry 101 %tmp4 = load i8* @g_3 ; <i8> [#uses=1] 102 %conv5 = sext i8 %tmp4 to i32 ; <i32> [#uses=1] 103 ret i32 %conv5 104 105 return: ; preds = %lor.lhs.false 106 ret i32 0 107 } 108 109 define void @bar(i32 %p_5) noreturn nounwind { 110 entry: 111 %cmp = icmp sgt i32 %p_5, 0 ; <i1> [#uses=2] 112 %call = tail call i32 @safe() nounwind ; <i32> [#uses=1] 113 %conv1 = trunc i32 %call to i8 ; <i8> [#uses=3] 114 %tobool.i = xor i1 %cmp, true ; <i1> [#uses=3] 115 %cmp.i = icmp sgt i8 %conv1, 0 ; <i1> [#uses=3] 116 %or.cond.i = or i1 %cmp.i, %tobool.i ; <i1> [#uses=1] 117 br i1 %or.cond.i, label %lor.rhs.i, label %land.lhs.true3.i 118 119 land.lhs.true3.i: ; preds = %entry 120 %xor = zext i1 %cmp to i32 ; <i32> [#uses=1] 121 %conv5.i = sext i8 %conv1 to i32 ; <i32> [#uses=1] 122 %cmp7.i = icmp slt i32 %conv5.i, %xor ; <i1> [#uses=1] 123 %cmp7.i.not = xor i1 %cmp7.i, true ; <i1> [#uses=1] 124 %or.cond23.i = and i1 %cmp.i, %tobool.i ; <i1> [#uses=1] 125 %or.cond = and i1 %cmp7.i.not, %or.cond23.i ; <i1> [#uses=1] 126 br i1 %or.cond, label %lor.end.i, label %for.inc 127 128 lor.rhs.i: ; preds = %entry 129 %or.cond23.i.old = and i1 %cmp.i, %tobool.i ; <i1> [#uses=1] 130 br i1 %or.cond23.i.old, label %lor.end.i, label %for.inc 131 132 lor.end.i: ; preds = %lor.rhs.i, %land.lhs.true3.i 133 %tobool19.i = icmp eq i8 %conv1, 0 ; <i1> [#uses=0] 134 br label %for.inc 135 136 for.inc: ; preds = %for.inc, %lor.end.i, %lor.rhs.i, %land.lhs.true3.i 137 br label %for.inc 138 } 139 140 declare i32 @safe() 141