1 ; RUN: llc < %s -verify-coalescing 2 ; PR12911 3 target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64" 4 target triple = "x86_64-apple-macosx10.7.0" 5 6 @d = common global i32 0, align 4 7 @c = common global i32 0, align 4 8 @b = common global i32 0, align 4 9 @h = common global i32 0, align 4 10 @f = common global i32 0, align 4 11 @g = common global i32 0, align 4 12 @a = common global i16 0, align 2 13 @e = common global i32 0, align 4 14 15 define void @fn1() nounwind uwtable ssp { 16 entry: 17 %0 = load i32, i32* @d, align 4 18 %tobool72 = icmp eq i32 %0, 0 19 br i1 %tobool72, label %for.end32, label %for.cond1.preheader.lr.ph 20 21 for.cond1.preheader.lr.ph: ; preds = %entry 22 %1 = load i32, i32* @c, align 4 23 %tobool2 = icmp eq i32 %1, 0 24 %2 = load i32, i32* @b, align 4 25 %cmp = icmp sgt i32 %2, 0 26 %conv = zext i1 %cmp to i32 27 %3 = load i32, i32* @g, align 4 28 %tobool4 = icmp eq i32 %3, 0 29 %4 = load i16, i16* @a, align 2 30 %tobool9 = icmp eq i16 %4, 0 31 br label %for.cond1.preheader 32 33 for.cond1.preheader: ; preds = %for.cond25.loopexit.us-lcssa.us-lcssa, %if.end.us50, %if.end.us, %if.end.us.us, %for.cond1.preheader.lr.ph 34 %j.073 = phi i32 [ undef, %for.cond1.preheader.lr.ph ], [ %j.1.us.us, %if.end.us.us ], [ %j.1.us, %if.end.us ], [ %j.073, %for.cond25.loopexit.us-lcssa.us-lcssa ], [ %j.1.us36, %if.end.us50 ] 35 br i1 %tobool2, label %for.cond1.preheader.split.us, label %for.cond1.preheader.for.cond1.preheader.split_crit_edge 36 37 for.cond1.preheader.for.cond1.preheader.split_crit_edge: ; preds = %for.cond1.preheader 38 br i1 %tobool9, label %if.end.us50, label %for.cond1.preheader.split.for.cond1.preheader.split.split_crit_edge 39 40 for.cond1.preheader.split.us: ; preds = %for.cond1.preheader 41 br i1 %tobool9, label %cond.end.us.us, label %cond.end.us 42 43 cond.false18.us.us: ; preds = %if.end.us.us 44 %5 = load i32, i32* @f, align 4 45 %sext76 = shl i32 %5, 16 46 %phitmp75 = ashr exact i32 %sext76, 16 47 br label %cond.end.us.us 48 49 if.end.us.us: ; preds = %cond.end.us.us, %if.then.us.us 50 br i1 %tobool4, label %cond.false18.us.us, label %for.cond1.preheader 51 52 if.then.us.us: ; preds = %cond.end.us.us 53 store i32 0, i32* @f, align 4 54 br label %if.end.us.us 55 56 cond.end.us.us: ; preds = %cond.false18.us.us, %for.cond1.preheader.split.us 57 %j.1.us.us = phi i32 [ %j.073, %for.cond1.preheader.split.us ], [ %phitmp75, %cond.false18.us.us ] 58 store i32 %conv, i32* @h, align 4 59 br i1 %cmp, label %if.then.us.us, label %if.end.us.us 60 61 cond.end21.us: ; preds = %land.lhs.true12.us, %cond.false18.us 62 %cond22.us = phi i16 [ %add.us, %cond.false18.us ], [ %4, %land.lhs.true12.us ] 63 %conv24.us = sext i16 %cond22.us to i32 64 br label %cond.end.us 65 66 cond.false18.us: ; preds = %if.end6.us, %land.lhs.true12.us 67 %add.us = add i16 %4, %conv7.us 68 br label %cond.end21.us 69 70 land.lhs.true12.us: ; preds = %if.end6.us 71 %conv10.us = sext i16 %conv7.us to i32 72 %sub.us = sub nsw i32 0, %conv10.us 73 %cmp14.us = icmp slt i32 %sub.us, 1 74 br i1 %cmp14.us, label %cond.end21.us, label %cond.false18.us 75 76 if.end6.us: ; preds = %if.end.us 77 %6 = load i32, i32* @f, align 4 78 %conv7.us = trunc i32 %6 to i16 79 %tobool11.us = icmp eq i16 %conv7.us, 0 80 br i1 %tobool11.us, label %cond.false18.us, label %land.lhs.true12.us 81 82 if.end.us: ; preds = %cond.end.us, %if.then.us 83 br i1 %tobool4, label %if.end6.us, label %for.cond1.preheader 84 85 if.then.us: ; preds = %cond.end.us 86 store i32 0, i32* @f, align 4 87 br label %if.end.us 88 89 cond.end.us: ; preds = %cond.end21.us, %for.cond1.preheader.split.us 90 %j.1.us = phi i32 [ %conv24.us, %cond.end21.us ], [ %j.073, %for.cond1.preheader.split.us ] 91 store i32 %conv, i32* @h, align 4 92 br i1 %cmp, label %if.then.us, label %if.end.us 93 94 for.cond1.preheader.split.for.cond1.preheader.split.split_crit_edge: ; preds = %for.cond1.preheader.for.cond1.preheader.split_crit_edge 95 br i1 %tobool4, label %if.end6.us65, label %for.cond25.loopexit.us-lcssa.us-lcssa 96 97 cond.false18.us40: ; preds = %if.end.us50 98 %7 = load i32, i32* @f, align 4 99 %sext = shl i32 %7, 16 100 %phitmp = ashr exact i32 %sext, 16 101 br label %if.end.us50 102 103 if.end.us50: ; preds = %cond.false18.us40, %for.cond1.preheader.for.cond1.preheader.split_crit_edge 104 %j.1.us36 = phi i32 [ %j.073, %for.cond1.preheader.for.cond1.preheader.split_crit_edge ], [ %phitmp, %cond.false18.us40 ] 105 store i32 0, i32* @h, align 4 106 br i1 %tobool4, label %cond.false18.us40, label %for.cond1.preheader 107 108 if.end6.us65: ; preds = %if.end6.us65, %for.cond1.preheader.split.for.cond1.preheader.split.split_crit_edge 109 store i32 0, i32* @h, align 4 110 br label %if.end6.us65 111 112 for.cond25.loopexit.us-lcssa.us-lcssa: ; preds = %for.cond1.preheader.split.for.cond1.preheader.split.split_crit_edge 113 store i32 0, i32* @h, align 4 114 br label %for.cond1.preheader 115 116 for.end32: ; preds = %entry 117 ret void 118 } 119