162 lines · plain
1; RUN: llc -verify-regalloc -verify-machineinstrs < %s2; PR27275: When enabling remat for vreg defined by PHIs, make sure the update3; of the live range removes dead phi. Otherwise, we may end up with PHIs with4; incorrect operands and that will trigger assertions or verifier failures5; in later passes.6 7target datalayout = "e-m:e-p:32:32-f64:32:64-f80:32-n8:16:32-S128"8target triple = "i386-unknown-linux-gnu"9 10@b = external global i64, align 811@d = external global i32, align 412@e = external global i64, align 813@h = external global i16, align 214@a = external global i8, align 115@g = external global i64, align 816@j = external global i32, align 417@f = external global i16, align 218@.str = external unnamed_addr constant [12 x i8], align 119 20define void @fn1(i1 %arg) {21entry:22 %tmp = load i64, ptr @b, align 823 %or = or i64 0, 329992131724 %and = and i64 %or, %tmp25 %tmp1 = load i32, ptr @d, align 426 br i1 %arg, label %lor.rhs, label %lor.end27 28lor.rhs: ; preds = %entry29 %tobool3 = icmp ne i8 undef, 030 br label %lor.end31 32lor.end: ; preds = %lor.rhs, %entry33 %lor.ext = zext i1 undef to i3234 %tmp2 = load i64, ptr @e, align 835 br i1 %arg, label %lor.rhs5, label %lor.end736 37lor.rhs5: ; preds = %lor.end38 br label %lor.end739 40lor.end7: ; preds = %lor.rhs5, %lor.end41 %tmp3 = phi i1 [ true, %lor.end ], [ false, %lor.rhs5 ]42 %neg13 = xor i64 %tmp, -143 %conv25 = zext i1 %tmp3 to i3244 %tobool46 = icmp eq i64 %tmp, 045 %.pre = load i16, ptr @h, align 246 %tobool10 = icmp eq i16 %.pre, 047 %neg.us = xor i32 %tmp1, -148 %conv12.us = sext i32 %neg.us to i6449 %tobool23.us = icmp eq i64 %tmp2, %and50 %conv39.us = sext i32 %tmp1 to i6451 br label %LABEL_mSmSDb52 53LABEL_mSmSDb.loopexit: ; preds = %lor.end32.us54 %conv42.us.lcssa = phi i32 [ %conv42.us, %lor.end32.us ]55 store i64 undef, ptr @g, align 856 br label %LABEL_mSmSDb57 58LABEL_mSmSDb: ; preds = %LABEL_mSmSDb.loopexit, %lor.end759 %tmp4 = phi i32 [ undef, %lor.end7 ], [ %conv42.us.lcssa, %LABEL_mSmSDb.loopexit ]60 %tmp5 = phi i64 [ %tmp, %lor.end7 ], [ 0, %LABEL_mSmSDb.loopexit ]61 br i1 %tobool10, label %LABEL_BRBRN.preheader, label %if.then62 63if.then: ; preds = %LABEL_mSmSDb64 store i8 undef, ptr @a, align 165 br label %LABEL_BRBRN.preheader66 67LABEL_BRBRN.preheader: ; preds = %if.then, %LABEL_mSmSDb68 %.pre63 = load i64, ptr @g, align 869 br i1 %tobool46, label %LABEL_BRBRN.us, label %LABEL_BRBRN.outer70 71LABEL_BRBRN.outer: ; preds = %if.then47, %LABEL_BRBRN.preheader72 %.ph = phi i32 [ 0, %if.then47 ], [ %tmp4, %LABEL_BRBRN.preheader ]73 %.ph64 = phi i32 [ %conv50, %if.then47 ], [ %tmp1, %LABEL_BRBRN.preheader ]74 %.ph65 = phi i64 [ %tmp16, %if.then47 ], [ %.pre63, %LABEL_BRBRN.preheader ]75 %.ph66 = phi i64 [ 0, %if.then47 ], [ %tmp2, %LABEL_BRBRN.preheader ]76 %.ph67 = phi i64 [ %.pre56.pre, %if.then47 ], [ %tmp5, %LABEL_BRBRN.preheader ]77 %neg = xor i32 %.ph64, -178 %conv12 = sext i32 %neg to i6479 %tobool23 = icmp eq i64 %.ph66, %and80 %tmp6 = load i32, ptr @j, align 481 %shr = lshr i32 %conv25, %tmp682 %conv39 = sext i32 %.ph64 to i6483 br label %LABEL_BRBRN84 85LABEL_BRBRN.us: ; preds = %lor.end32.us, %LABEL_BRBRN.preheader86 %tmp7 = phi i32 [ %conv42.us, %lor.end32.us ], [ %tmp4, %LABEL_BRBRN.preheader ]87 %tmp8 = phi i64 [ undef, %lor.end32.us ], [ %.pre63, %LABEL_BRBRN.preheader ]88 %tmp9 = phi i64 [ %tmp10, %lor.end32.us ], [ %tmp5, %LABEL_BRBRN.preheader ]89 %mul.us = mul i64 %tmp8, %neg1390 %mul14.us = mul i64 %mul.us, %conv12.us91 %cmp.us = icmp sgt i64 %tmp2, %mul14.us92 %conv16.us = zext i1 %cmp.us to i6493 %xor.us = xor i64 %conv16.us, %tmp994 %rem18.us = urem i32 %lor.ext, %tmp795 %conv19.us = zext i32 %rem18.us to i6496 br i1 %tobool23.us, label %lor.rhs24.us, label %lor.end32.us97 98lor.rhs24.us: ; preds = %LABEL_BRBRN.us99 br label %lor.end32.us100 101lor.end32.us: ; preds = %lor.rhs24.us, %LABEL_BRBRN.us102 %tmp10 = phi i64 [ -2, %LABEL_BRBRN.us ], [ -1, %lor.rhs24.us ]103 %xor.us.not = xor i64 %xor.us, -1104 %neg36.us = and i64 %conv19.us, %xor.us.not105 %conv37.us = zext i32 %tmp7 to i64106 %sub38.us = sub nsw i64 %neg36.us, %conv37.us107 %mul40.us = mul nsw i64 %sub38.us, %conv39.us108 %neg41.us = xor i64 %mul40.us, 4294967295109 %conv42.us = trunc i64 %neg41.us to i32110 %tobool43.us = icmp eq i8 undef, 0111 br i1 %tobool43.us, label %LABEL_mSmSDb.loopexit, label %LABEL_BRBRN.us112 113LABEL_BRBRN: ; preds = %lor.end32, %LABEL_BRBRN.outer114 %tmp11 = phi i32 [ %conv42, %lor.end32 ], [ %.ph, %LABEL_BRBRN.outer ]115 %tmp12 = phi i64 [ %neg21, %lor.end32 ], [ %.ph65, %LABEL_BRBRN.outer ]116 %tmp13 = phi i64 [ %conv35, %lor.end32 ], [ %.ph67, %LABEL_BRBRN.outer ]117 %mul = mul i64 %tmp12, %neg13118 %mul14 = mul i64 %mul, %conv12119 %cmp = icmp sgt i64 %.ph66, %mul14120 %conv16 = zext i1 %cmp to i64121 %xor = xor i64 %conv16, %tmp13122 %rem18 = urem i32 %lor.ext, %tmp11123 %conv19 = zext i32 %rem18 to i64124 %neg21 = or i64 %xor, undef125 br i1 %tobool23, label %lor.rhs24, label %lor.end32126 127lor.rhs24: ; preds = %LABEL_BRBRN128 %tmp14 = load volatile i16, ptr @f, align 2129 %conv26 = sext i16 %tmp14 to i32130 %and27 = and i32 %conv26, %shr131 %conv28 = sext i32 %and27 to i64132 %mul29 = mul nsw i64 %conv28, %tmp133 %and30 = and i64 %mul29, %tmp13134 %tobool31 = icmp ne i64 %and30, 0135 br label %lor.end32136 137lor.end32: ; preds = %lor.rhs24, %LABEL_BRBRN138 %tmp15 = phi i1 [ true, %LABEL_BRBRN ], [ %tobool31, %lor.rhs24 ]139 %lor.ext33 = zext i1 %tmp15 to i32140 %neg34 = xor i32 %lor.ext33, -1141 %conv35 = sext i32 %neg34 to i64142 %xor.not = xor i64 %xor, -1143 %neg36 = and i64 %conv19, %xor.not144 %conv37 = zext i32 %tmp11 to i64145 %sub38 = sub nsw i64 %neg36, %conv37146 %mul40 = mul nsw i64 %sub38, %conv39147 %neg41 = xor i64 %mul40, 4294967295148 %conv42 = trunc i64 %neg41 to i32149 %tobool43 = icmp eq i8 undef, 0150 br i1 %tobool43, label %if.then47, label %LABEL_BRBRN151 152if.then47: ; preds = %lor.end32153 tail call void (ptr, ...) @printf(ptr @.str, i64 %conv39)154 %tmp16 = load i64, ptr @g, align 8155 %neg49 = xor i64 %tmp16, 4294967295156 %conv50 = trunc i64 %neg49 to i32157 %.pre56.pre = load i64, ptr @b, align 8158 br label %LABEL_BRBRN.outer159}160 161declare void @printf(ptr nocapture readonly, ...)162