diff --git a/lib/Analysis/InstructionSimplify.cpp b/lib/Analysis/InstructionSimplify.cpp index 4706969eafc..0655374cbc1 100644 --- a/lib/Analysis/InstructionSimplify.cpp +++ b/lib/Analysis/InstructionSimplify.cpp @@ -924,19 +924,19 @@ static Value *simplifyDivRem(Value *Op0, Value *Op1, bool IsDiv, const SimplifyQuery &Q) { Type *Ty = Op0->getType(); - // X / undef -> undef - // X % undef -> undef + // X / undef -> poison + // X % undef -> poison if (Q.isUndefValue(Op1)) - return Op1; + return PoisonValue::get(Ty); - // X / 0 -> undef - // X % 0 -> undef + // X / 0 -> poison + // X % 0 -> poison // We don't need to preserve faults! if (match(Op1, m_Zero())) - return UndefValue::get(Ty); + return PoisonValue::get(Ty); - // If any element of a constant divisor fixed width vector is zero or undef, - // the whole op is undef. + // If any element of a constant divisor fixed width vector is zero or undef + // the behavior is undefined and we can fold the whole op to poison. auto *Op1C = dyn_cast(Op1); auto *VTy = dyn_cast(Ty); if (Op1C && VTy) { @@ -944,7 +944,7 @@ static Value *simplifyDivRem(Value *Op0, Value *Op1, bool IsDiv, for (unsigned i = 0; i != NumElts; ++i) { Constant *Elt = Op1C->getAggregateElement(i); if (Elt && (Elt->isNullValue() || Q.isUndefValue(Elt))) - return UndefValue::get(Ty); + return PoisonValue::get(Ty); } } diff --git a/test/Transforms/InstCombine/add-shl-sdiv-to-srem.ll b/test/Transforms/InstCombine/add-shl-sdiv-to-srem.ll index 57a10c165f1..1dee5eb90ea 100644 --- a/test/Transforms/InstCombine/add-shl-sdiv-to-srem.ll +++ b/test/Transforms/InstCombine/add-shl-sdiv-to-srem.ll @@ -212,7 +212,7 @@ define <2 x i64> @add-shl-sdiv-negative4(<2 x i64> %x) { define <3 x i8> @add-shl-sdiv-3xi8-undef0(<3 x i8> %x) { ; CHECK-LABEL: @add-shl-sdiv-3xi8-undef0( -; CHECK-NEXT: ret <3 x i8> [[X:%.*]] +; CHECK-NEXT: ret <3 x i8> poison ; %sd = sdiv <3 x i8> %x, %sl = shl <3 x i8> %sd, diff --git a/test/Transforms/InstCombine/div.ll b/test/Transforms/InstCombine/div.ll index e06faf43348..835db5e2c6c 100644 --- a/test/Transforms/InstCombine/div.ll +++ b/test/Transforms/InstCombine/div.ll @@ -40,7 +40,7 @@ define <2 x i64> @sdiv_by_minus1_vec(<2 x i64> %x) { define <2 x i64> @sdiv_by_minus1_vec_undef_elt(<2 x i64> %x) { ; CHECK-LABEL: @sdiv_by_minus1_vec_undef_elt( -; CHECK-NEXT: ret <2 x i64> undef +; CHECK-NEXT: ret <2 x i64> poison ; %div = sdiv <2 x i64> %x, ret <2 x i64> %div @@ -514,7 +514,7 @@ define <2 x i8> @sdiv_negated_dividend_constant_divisor_vec_splat_smin(<2 x i8> define <2 x i8> @sdiv_negated_dividend_constant_divisor_vec_undef(<2 x i8> %x) { ; CHECK-LABEL: @sdiv_negated_dividend_constant_divisor_vec_undef( -; CHECK-NEXT: ret <2 x i8> undef +; CHECK-NEXT: ret <2 x i8> poison ; %neg = sub nsw <2 x i8> zeroinitializer, %x %d = sdiv <2 x i8> %neg, @@ -523,8 +523,8 @@ define <2 x i8> @sdiv_negated_dividend_constant_divisor_vec_undef(<2 x i8> %x) { define <2 x i64> @sdiv_negated_dividend_constant_divisor_vec(<2 x i64> %x) { ; CHECK-LABEL: @sdiv_negated_dividend_constant_divisor_vec( -; CHECK-NEXT: [[DIV:%.*]] = sdiv <2 x i64> [[X:%.*]], -; CHECK-NEXT: ret <2 x i64> [[DIV]] +; CHECK-NEXT: [[DIV1_NEG:%.*]] = sdiv <2 x i64> [[X:%.*]], +; CHECK-NEXT: ret <2 x i64> [[DIV1_NEG]] ; %neg = sub nsw <2 x i64> zeroinitializer, %x %div = sdiv <2 x i64> %neg, @@ -533,8 +533,8 @@ define <2 x i64> @sdiv_negated_dividend_constant_divisor_vec(<2 x i64> %x) { define <2 x i64> @sdiv_exact_negated_dividend_constant_divisor_vec(<2 x i64> %x) { ; CHECK-LABEL: @sdiv_exact_negated_dividend_constant_divisor_vec( -; CHECK-NEXT: [[DIV:%.*]] = sdiv exact <2 x i64> [[X:%.*]], -; CHECK-NEXT: ret <2 x i64> [[DIV]] +; CHECK-NEXT: [[DIV1_NEG:%.*]] = sdiv exact <2 x i64> [[X:%.*]], +; CHECK-NEXT: ret <2 x i64> [[DIV1_NEG]] ; %neg = sub nsw <2 x i64> zeroinitializer, %x %div = sdiv exact <2 x i64> %neg, @@ -849,8 +849,8 @@ define <2 x i8> @udiv_common_factor_not_nuw_vec(<2 x i8> %x, <2 x i8> %y, <2 x i define i32 @test_exact_nsw_exact(i32 %x) { ; CHECK-LABEL: @test_exact_nsw_exact( -; CHECK-NEXT: [[NEG:%.*]] = sdiv exact i32 [[X:%.*]], -3 -; CHECK-NEXT: ret i32 [[NEG]] +; CHECK-NEXT: [[DIV_NEG:%.*]] = sdiv exact i32 [[X:%.*]], -3 +; CHECK-NEXT: ret i32 [[DIV_NEG]] ; %div = sdiv exact i32 %x, 3 %neg = sub nsw i32 0, %div @@ -859,8 +859,8 @@ define i32 @test_exact_nsw_exact(i32 %x) { define <2 x i64> @test_exact_vec(<2 x i64> %x) { ; CHECK-LABEL: @test_exact_vec( -; CHECK-NEXT: [[NEG:%.*]] = sdiv exact <2 x i64> [[X:%.*]], -; CHECK-NEXT: ret <2 x i64> [[NEG]] +; CHECK-NEXT: [[DIV_NEG:%.*]] = sdiv exact <2 x i64> [[X:%.*]], +; CHECK-NEXT: ret <2 x i64> [[DIV_NEG]] ; %div = sdiv exact <2 x i64> %x, %neg = sub nsw <2 x i64> zeroinitializer, %div @@ -871,8 +871,8 @@ define <2 x i64> @test_exact_vec(<2 x i64> %x) { define <2 x i8> @negate_sdiv_vec_splat(<2 x i8> %x) { ; CHECK-LABEL: @negate_sdiv_vec_splat( -; CHECK-NEXT: [[NEG:%.*]] = sdiv <2 x i8> [[X:%.*]], -; CHECK-NEXT: ret <2 x i8> [[NEG]] +; CHECK-NEXT: [[DIV_NEG:%.*]] = sdiv <2 x i8> [[X:%.*]], +; CHECK-NEXT: ret <2 x i8> [[DIV_NEG]] ; %div = sdiv <2 x i8> %x, %neg = sub <2 x i8> zeroinitializer, %div @@ -883,7 +883,7 @@ define <2 x i8> @negate_sdiv_vec_splat(<2 x i8> %x) { define <2 x i8> @negate_sdiv_vec_undef_elt(<2 x i8> %x) { ; CHECK-LABEL: @negate_sdiv_vec_undef_elt( -; CHECK-NEXT: ret <2 x i8> undef +; CHECK-NEXT: ret <2 x i8> poison ; %div = sdiv <2 x i8> %x, %neg = sub <2 x i8> zeroinitializer, %div @@ -907,8 +907,8 @@ define <2 x i8> @negate_sdiv_vec_splat_one(<2 x i8> %x) { define <2 x i8> @negate_sdiv_vec_splat_signed_min(<2 x i8> %x) { ; CHECK-LABEL: @negate_sdiv_vec_splat_signed_min( ; CHECK-NEXT: [[TMP1:%.*]] = icmp eq <2 x i8> [[X:%.*]], -; CHECK-NEXT: [[NEG:%.*]] = sext <2 x i1> [[TMP1]] to <2 x i8> -; CHECK-NEXT: ret <2 x i8> [[NEG]] +; CHECK-NEXT: [[DIV_NEG:%.*]] = sext <2 x i1> [[TMP1]] to <2 x i8> +; CHECK-NEXT: ret <2 x i8> [[DIV_NEG]] ; %div = sdiv <2 x i8> %x, %neg = sub <2 x i8> zeroinitializer, %div @@ -956,8 +956,8 @@ define <2 x i8> @negate_sdiv_vec_signed_min_and_one_elt(<2 x i8> %x) { define i32 @test_exact_nonsw_exact(i32 %x) { ; CHECK-LABEL: @test_exact_nonsw_exact( -; CHECK-NEXT: [[NEG:%.*]] = sdiv exact i32 [[X:%.*]], -3 -; CHECK-NEXT: ret i32 [[NEG]] +; CHECK-NEXT: [[DIV_NEG:%.*]] = sdiv exact i32 [[X:%.*]], -3 +; CHECK-NEXT: ret i32 [[DIV_NEG]] ; %div = sdiv exact i32 %x, 3 %neg = sub i32 0, %div @@ -966,8 +966,8 @@ define i32 @test_exact_nonsw_exact(i32 %x) { define i32 @test_exact_nsw_noexact(i32 %x) { ; CHECK-LABEL: @test_exact_nsw_noexact( -; CHECK-NEXT: [[NEG:%.*]] = sdiv i32 [[X:%.*]], -3 -; CHECK-NEXT: ret i32 [[NEG]] +; CHECK-NEXT: [[DIV_NEG:%.*]] = sdiv i32 [[X:%.*]], -3 +; CHECK-NEXT: ret i32 [[DIV_NEG]] ; %div = sdiv i32 %x, 3 %neg = sub nsw i32 0, %div @@ -976,8 +976,8 @@ define i32 @test_exact_nsw_noexact(i32 %x) { define i32 @test_exact_nonsw_noexact(i32 %x) { ; CHECK-LABEL: @test_exact_nonsw_noexact( -; CHECK-NEXT: [[NEG:%.*]] = sdiv i32 [[X:%.*]], -3 -; CHECK-NEXT: ret i32 [[NEG]] +; CHECK-NEXT: [[DIV_NEG:%.*]] = sdiv i32 [[X:%.*]], -3 +; CHECK-NEXT: ret i32 [[DIV_NEG]] ; %div = sdiv i32 %x, 3 %neg = sub i32 0, %div @@ -1008,8 +1008,8 @@ define i32 @test_exact_div_one(i32 %x) { define i8 @test_exact_div_minSigned(i8 %x) { ; CHECK-LABEL: @test_exact_div_minSigned( ; CHECK-NEXT: [[TMP1:%.*]] = icmp eq i8 [[X:%.*]], -128 -; CHECK-NEXT: [[NEG:%.*]] = sext i1 [[TMP1]] to i8 -; CHECK-NEXT: ret i8 [[NEG]] +; CHECK-NEXT: [[DIV_NEG:%.*]] = sext i1 [[TMP1]] to i8 +; CHECK-NEXT: ret i8 [[DIV_NEG]] ; %div = sdiv exact i8 %x, -128 %neg = sub nsw i8 0, %div @@ -1040,7 +1040,7 @@ define <2 x i8> @sdiv_by_int_min_vec_splat(<2 x i8> %x) { define <2 x i8> @sdiv_by_int_min_vec_splat_undef(<2 x i8> %x) { ; CHECK-LABEL: @sdiv_by_int_min_vec_splat_undef( -; CHECK-NEXT: ret <2 x i8> undef +; CHECK-NEXT: ret <2 x i8> poison ; %d = sdiv <2 x i8> %x, ret <2 x i8> %d diff --git a/test/Transforms/InstCombine/icmp-div-constant.ll b/test/Transforms/InstCombine/icmp-div-constant.ll index b68a5673faa..64f244f9638 100644 --- a/test/Transforms/InstCombine/icmp-div-constant.ll +++ b/test/Transforms/InstCombine/icmp-div-constant.ll @@ -119,10 +119,10 @@ define i32 @icmp_div(i16 %a, i16 %c) { ; CHECK-NEXT: br i1 [[TOBOOL]], label [[THEN:%.*]], label [[EXIT:%.*]] ; CHECK: then: ; CHECK-NEXT: [[CMP:%.*]] = icmp eq i16 [[C:%.*]], 0 -; CHECK-NEXT: [[PHITMP1:%.*]] = sext i1 [[CMP]] to i32 +; CHECK-NEXT: [[PHI_BO:%.*]] = sext i1 [[CMP]] to i32 ; CHECK-NEXT: br label [[EXIT]] ; CHECK: exit: -; CHECK-NEXT: [[PHI:%.*]] = phi i32 [ -1, [[ENTRY:%.*]] ], [ [[PHITMP1]], [[THEN]] ] +; CHECK-NEXT: [[PHI:%.*]] = phi i32 [ -1, [[ENTRY:%.*]] ], [ [[PHI_BO]], [[THEN]] ] ; CHECK-NEXT: ret i32 [[PHI]] ; entry: @@ -149,8 +149,7 @@ define i32 @icmp_div2(i16 %a, i16 %c) { ; CHECK: then: ; CHECK-NEXT: br label [[EXIT]] ; CHECK: exit: -; CHECK-NEXT: [[PHI:%.*]] = phi i32 [ -1, [[ENTRY:%.*]] ], [ 0, [[THEN]] ] -; CHECK-NEXT: ret i32 [[PHI]] +; CHECK-NEXT: ret i32 -1 ; entry: %tobool = icmp eq i16 %a, 0 @@ -175,10 +174,10 @@ define i32 @icmp_div3(i16 %a, i16 %c) { ; CHECK-NEXT: br i1 [[TOBOOL]], label [[THEN:%.*]], label [[EXIT:%.*]] ; CHECK: then: ; CHECK-NEXT: [[CMP:%.*]] = icmp eq i16 [[C:%.*]], 0 -; CHECK-NEXT: [[PHITMP1:%.*]] = sext i1 [[CMP]] to i32 +; CHECK-NEXT: [[PHI_BO:%.*]] = sext i1 [[CMP]] to i32 ; CHECK-NEXT: br label [[EXIT]] ; CHECK: exit: -; CHECK-NEXT: [[PHI:%.*]] = phi i32 [ -1, [[ENTRY:%.*]] ], [ [[PHITMP1]], [[THEN]] ] +; CHECK-NEXT: [[PHI:%.*]] = phi i32 [ -1, [[ENTRY:%.*]] ], [ [[PHI_BO]], [[THEN]] ] ; CHECK-NEXT: ret i32 [[PHI]] ; entry: diff --git a/test/Transforms/InstCombine/inselt-binop-inseltpoison.ll b/test/Transforms/InstCombine/inselt-binop-inseltpoison.ll index 856eb61ba0b..adcbc3af390 100644 --- a/test/Transforms/InstCombine/inselt-binop-inseltpoison.ll +++ b/test/Transforms/InstCombine/inselt-binop-inseltpoison.ll @@ -247,7 +247,7 @@ define <2 x i8> @urem_constant_op0_not_undef_lane(i8 %x) { define <2 x i8> @urem_constant_op1(i8 %x) { ; CHECK-LABEL: @urem_constant_op1( -; CHECK-NEXT: ret <2 x i8> undef +; CHECK-NEXT: ret <2 x i8> poison ; %ins = insertelement <2 x i8> poison, i8 %x, i32 1 %bo = urem <2 x i8> %ins, @@ -289,7 +289,7 @@ define <2 x i8> @srem_constant_op0_not_undef_lane(i8 %x) { define <2 x i8> @srem_constant_op1(i8 %x) { ; CHECK-LABEL: @srem_constant_op1( -; CHECK-NEXT: ret <2 x i8> undef +; CHECK-NEXT: ret <2 x i8> poison ; %ins = insertelement <2 x i8> poison, i8 %x, i32 1 %bo = srem <2 x i8> %ins, @@ -331,7 +331,7 @@ define <2 x i8> @udiv_constant_op0_not_undef_lane(i8 %x) { define <2 x i8> @udiv_constant_op1(i8 %x) { ; CHECK-LABEL: @udiv_constant_op1( -; CHECK-NEXT: ret <2 x i8> undef +; CHECK-NEXT: ret <2 x i8> poison ; %ins = insertelement <2 x i8> poison, i8 %x, i32 1 %bo = udiv <2 x i8> %ins, @@ -373,7 +373,7 @@ define <2 x i8> @sdiv_constant_op0_not_undef_lane(i8 %x) { define <2 x i8> @sdiv_constant_op1(i8 %x) { ; CHECK-LABEL: @sdiv_constant_op1( -; CHECK-NEXT: ret <2 x i8> undef +; CHECK-NEXT: ret <2 x i8> poison ; %ins = insertelement <2 x i8> poison, i8 %x, i32 1 %bo = sdiv exact <2 x i8> %ins, diff --git a/test/Transforms/InstCombine/inselt-binop.ll b/test/Transforms/InstCombine/inselt-binop.ll index 64296c9fd5a..1d979f9e1e8 100644 --- a/test/Transforms/InstCombine/inselt-binop.ll +++ b/test/Transforms/InstCombine/inselt-binop.ll @@ -247,7 +247,7 @@ define <2 x i8> @urem_constant_op0_not_undef_lane(i8 %x) { define <2 x i8> @urem_constant_op1(i8 %x) { ; CHECK-LABEL: @urem_constant_op1( -; CHECK-NEXT: ret <2 x i8> undef +; CHECK-NEXT: ret <2 x i8> poison ; %ins = insertelement <2 x i8> undef, i8 %x, i32 1 %bo = urem <2 x i8> %ins, @@ -289,7 +289,7 @@ define <2 x i8> @srem_constant_op0_not_undef_lane(i8 %x) { define <2 x i8> @srem_constant_op1(i8 %x) { ; CHECK-LABEL: @srem_constant_op1( -; CHECK-NEXT: ret <2 x i8> undef +; CHECK-NEXT: ret <2 x i8> poison ; %ins = insertelement <2 x i8> undef, i8 %x, i32 1 %bo = srem <2 x i8> %ins, @@ -331,7 +331,7 @@ define <2 x i8> @udiv_constant_op0_not_undef_lane(i8 %x) { define <2 x i8> @udiv_constant_op1(i8 %x) { ; CHECK-LABEL: @udiv_constant_op1( -; CHECK-NEXT: ret <2 x i8> undef +; CHECK-NEXT: ret <2 x i8> poison ; %ins = insertelement <2 x i8> undef, i8 %x, i32 1 %bo = udiv <2 x i8> %ins, @@ -373,7 +373,7 @@ define <2 x i8> @sdiv_constant_op0_not_undef_lane(i8 %x) { define <2 x i8> @sdiv_constant_op1(i8 %x) { ; CHECK-LABEL: @sdiv_constant_op1( -; CHECK-NEXT: ret <2 x i8> undef +; CHECK-NEXT: ret <2 x i8> poison ; %ins = insertelement <2 x i8> undef, i8 %x, i32 1 %bo = sdiv exact <2 x i8> %ins, diff --git a/test/Transforms/InstCombine/rem.ll b/test/Transforms/InstCombine/rem.ll index 37d81f2ebf6..8f0172e9521 100644 --- a/test/Transforms/InstCombine/rem.ll +++ b/test/Transforms/InstCombine/rem.ll @@ -247,7 +247,7 @@ define i32 @test5(i32 %X, i8 %B) { define i32 @test6(i32 %A) { ; CHECK-LABEL: @test6( -; CHECK-NEXT: ret i32 undef +; CHECK-NEXT: ret i32 poison ; %B = srem i32 %A, 0 ;; undef ret i32 %B diff --git a/test/Transforms/InstCombine/sdiv-exact-by-negative-power-of-two.ll b/test/Transforms/InstCombine/sdiv-exact-by-negative-power-of-two.ll index e19b7ad9c3d..9c88d122062 100644 --- a/test/Transforms/InstCombine/sdiv-exact-by-negative-power-of-two.ll +++ b/test/Transforms/InstCombine/sdiv-exact-by-negative-power-of-two.ll @@ -55,7 +55,7 @@ define <2 x i8> @n4_vec_mixed(<2 x i8> %x) { define <2 x i8> @n4_vec_undef(<2 x i8> %x) { ; CHECK-LABEL: @n4_vec_undef( -; CHECK-NEXT: ret <2 x i8> undef +; CHECK-NEXT: ret <2 x i8> poison ; %div = sdiv exact <2 x i8> %x, ret <2 x i8> %div diff --git a/test/Transforms/InstCombine/sdiv-exact-by-power-of-two.ll b/test/Transforms/InstCombine/sdiv-exact-by-power-of-two.ll index 282584b9888..09c9a039fc5 100644 --- a/test/Transforms/InstCombine/sdiv-exact-by-power-of-two.ll +++ b/test/Transforms/InstCombine/sdiv-exact-by-power-of-two.ll @@ -53,7 +53,7 @@ define <2 x i8> @t4_vec(<2 x i8> %x) { define <2 x i8> @n5_vec_undef(<2 x i8> %x) { ; CHECK-LABEL: @n5_vec_undef( -; CHECK-NEXT: ret <2 x i8> undef +; CHECK-NEXT: ret <2 x i8> poison ; %div = sdiv exact <2 x i8> %x, ret <2 x i8> %div diff --git a/test/Transforms/InstCombine/shift.ll b/test/Transforms/InstCombine/shift.ll index a64b9688248..6d9d74fd819 100644 --- a/test/Transforms/InstCombine/shift.ll +++ b/test/Transforms/InstCombine/shift.ll @@ -662,7 +662,7 @@ define <3 x i32> @test38_nonuniform(<3 x i32> %x) nounwind readnone { define <2 x i32> @test38_undef(<2 x i32> %x) nounwind readnone { ; CHECK-LABEL: @test38_undef( -; CHECK-NEXT: ret <2 x i32> undef +; CHECK-NEXT: ret <2 x i32> poison ; %rem = srem <2 x i32> %x, %shl = shl <2 x i32> , %rem diff --git a/test/Transforms/InstCombine/vector-udiv.ll b/test/Transforms/InstCombine/vector-udiv.ll index e16c93265ba..e8e5f067101 100644 --- a/test/Transforms/InstCombine/vector-udiv.ll +++ b/test/Transforms/InstCombine/vector-udiv.ll @@ -42,7 +42,7 @@ define <4 x i32> @test_v4i32_negconst(<4 x i32> %a0) { define <4 x i32> @test_v4i32_negconst_undef(<4 x i32> %a0) { ; CHECK-LABEL: @test_v4i32_negconst_undef( -; CHECK-NEXT: ret <4 x i32> undef +; CHECK-NEXT: ret <4 x i32> poison ; %1 = udiv <4 x i32> %a0, ret <4 x i32> %1 diff --git a/test/Transforms/InstCombine/vector-urem.ll b/test/Transforms/InstCombine/vector-urem.ll index c9b79b219ce..619fad8f619 100644 --- a/test/Transforms/InstCombine/vector-urem.ll +++ b/test/Transforms/InstCombine/vector-urem.ll @@ -21,7 +21,7 @@ define <4 x i32> @test_v4i32_const_pow2(<4 x i32> %a0) { define <4 x i32> @test_v4i32_const_pow2_undef(<4 x i32> %a0) { ; CHECK-LABEL: @test_v4i32_const_pow2_undef( -; CHECK-NEXT: ret <4 x i32> undef +; CHECK-NEXT: ret <4 x i32> poison ; %1 = urem <4 x i32> %a0, ret <4 x i32> %1 @@ -71,7 +71,7 @@ define <4 x i32> @test_v4i32_negconst(<4 x i32> %a0) { define <4 x i32> @test_v4i32_negconst_undef(<4 x i32> %a0) { ; CHECK-LABEL: @test_v4i32_negconst_undef( -; CHECK-NEXT: ret <4 x i32> undef +; CHECK-NEXT: ret <4 x i32> poison ; %1 = urem <4 x i32> %a0, ret <4 x i32> %1 diff --git a/test/Transforms/InstSimplify/div.ll b/test/Transforms/InstSimplify/div.ll index d2ba41c5afd..7c8efc27d3a 100644 --- a/test/Transforms/InstSimplify/div.ll +++ b/test/Transforms/InstSimplify/div.ll @@ -43,10 +43,9 @@ define <2 x i8> @udiv_zero_elt_vec_constfold(<2 x i8> %x) { ret <2 x i8> %div } -; TODO: instsimplify should fold these to poison define <2 x i8> @sdiv_zero_elt_vec(<2 x i8> %x) { ; CHECK-LABEL: @sdiv_zero_elt_vec( -; CHECK-NEXT: ret <2 x i8> undef +; CHECK-NEXT: ret <2 x i8> poison ; %div = sdiv <2 x i8> %x, ret <2 x i8> %div @@ -54,7 +53,7 @@ define <2 x i8> @sdiv_zero_elt_vec(<2 x i8> %x) { define <2 x i8> @udiv_zero_elt_vec(<2 x i8> %x) { ; CHECK-LABEL: @udiv_zero_elt_vec( -; CHECK-NEXT: ret <2 x i8> undef +; CHECK-NEXT: ret <2 x i8> poison ; %div = udiv <2 x i8> %x, ret <2 x i8> %div @@ -62,7 +61,7 @@ define <2 x i8> @udiv_zero_elt_vec(<2 x i8> %x) { define <2 x i8> @sdiv_undef_elt_vec(<2 x i8> %x) { ; CHECK-LABEL: @sdiv_undef_elt_vec( -; CHECK-NEXT: ret <2 x i8> undef +; CHECK-NEXT: ret <2 x i8> poison ; %div = sdiv <2 x i8> %x, ret <2 x i8> %div @@ -70,7 +69,7 @@ define <2 x i8> @sdiv_undef_elt_vec(<2 x i8> %x) { define <2 x i8> @udiv_undef_elt_vec(<2 x i8> %x) { ; CHECK-LABEL: @udiv_undef_elt_vec( -; CHECK-NEXT: ret <2 x i8> undef +; CHECK-NEXT: ret <2 x i8> poison ; %div = udiv <2 x i8> %x, ret <2 x i8> %div @@ -202,7 +201,6 @@ define i8 @sdiv_minusone_divisor() { ret i8 %v } -; TODO: these should be poison define i32 @poison(i32 %x) { ; CHECK-LABEL: @poison( ; CHECK-NEXT: ret i32 poison @@ -211,6 +209,7 @@ define i32 @poison(i32 %x) { ret i32 %v } +; TODO: this should be poison define i32 @poison2(i32 %x) { ; CHECK-LABEL: @poison2( ; CHECK-NEXT: ret i32 0 @@ -221,7 +220,7 @@ define i32 @poison2(i32 %x) { define <2 x i32> @poison3(<2 x i32> %x) { ; CHECK-LABEL: @poison3( -; CHECK-NEXT: ret <2 x i32> undef +; CHECK-NEXT: ret <2 x i32> poison ; %v = udiv <2 x i32> %x, ret <2 x i32> %v diff --git a/test/Transforms/InstSimplify/rem.ll b/test/Transforms/InstSimplify/rem.ll index 74b5ea7bfdc..6aaeb5c70d0 100644 --- a/test/Transforms/InstSimplify/rem.ll +++ b/test/Transforms/InstSimplify/rem.ll @@ -43,10 +43,9 @@ define <2 x i8> @urem_zero_elt_vec_constfold(<2 x i8> %x) { ret <2 x i8> %rem } -; TODO: instsimplify should fold these to poison define <2 x i8> @srem_zero_elt_vec(<2 x i8> %x) { ; CHECK-LABEL: @srem_zero_elt_vec( -; CHECK-NEXT: ret <2 x i8> undef +; CHECK-NEXT: ret <2 x i8> poison ; %rem = srem <2 x i8> %x, ret <2 x i8> %rem @@ -54,7 +53,7 @@ define <2 x i8> @srem_zero_elt_vec(<2 x i8> %x) { define <2 x i8> @urem_zero_elt_vec(<2 x i8> %x) { ; CHECK-LABEL: @urem_zero_elt_vec( -; CHECK-NEXT: ret <2 x i8> undef +; CHECK-NEXT: ret <2 x i8> poison ; %rem = urem <2 x i8> %x, ret <2 x i8> %rem @@ -62,7 +61,7 @@ define <2 x i8> @urem_zero_elt_vec(<2 x i8> %x) { define <2 x i8> @srem_undef_elt_vec(<2 x i8> %x) { ; CHECK-LABEL: @srem_undef_elt_vec( -; CHECK-NEXT: ret <2 x i8> undef +; CHECK-NEXT: ret <2 x i8> poison ; %rem = srem <2 x i8> %x, ret <2 x i8> %rem @@ -70,7 +69,7 @@ define <2 x i8> @srem_undef_elt_vec(<2 x i8> %x) { define <2 x i8> @urem_undef_elt_vec(<2 x i8> %x) { ; CHECK-LABEL: @urem_undef_elt_vec( -; CHECK-NEXT: ret <2 x i8> undef +; CHECK-NEXT: ret <2 x i8> poison ; %rem = urem <2 x i8> %x, ret <2 x i8> %rem diff --git a/test/Transforms/InstSimplify/undef.ll b/test/Transforms/InstSimplify/undef.ll index 80780899e84..024ef15d31e 100644 --- a/test/Transforms/InstSimplify/undef.ll +++ b/test/Transforms/InstSimplify/undef.ll @@ -188,7 +188,7 @@ define <4 x i8> @test19(<4 x i8> %a) { define i32 @test20(i32 %a) { ; CHECK-LABEL: @test20( -; CHECK-NEXT: ret i32 undef +; CHECK-NEXT: ret i32 poison ; %b = udiv i32 %a, 0 ret i32 %b @@ -196,7 +196,7 @@ define i32 @test20(i32 %a) { define <2 x i32> @test20vec(<2 x i32> %a) { ; CHECK-LABEL: @test20vec( -; CHECK-NEXT: ret <2 x i32> undef +; CHECK-NEXT: ret <2 x i32> poison ; %b = udiv <2 x i32> %a, zeroinitializer ret <2 x i32> %b @@ -204,7 +204,7 @@ define <2 x i32> @test20vec(<2 x i32> %a) { define i32 @test21(i32 %a) { ; CHECK-LABEL: @test21( -; CHECK-NEXT: ret i32 undef +; CHECK-NEXT: ret i32 poison ; %b = sdiv i32 %a, 0 ret i32 %b @@ -212,7 +212,7 @@ define i32 @test21(i32 %a) { define <2 x i32> @test21vec(<2 x i32> %a) { ; CHECK-LABEL: @test21vec( -; CHECK-NEXT: ret <2 x i32> undef +; CHECK-NEXT: ret <2 x i32> poison ; %b = sdiv <2 x i32> %a, zeroinitializer ret <2 x i32> %b @@ -348,7 +348,7 @@ define i32 @test37() { define i32 @test38(i32 %a) { ; CHECK-LABEL: @test38( -; CHECK-NEXT: ret i32 undef +; CHECK-NEXT: ret i32 poison ; %b = udiv i32 %a, undef ret i32 %b diff --git a/test/Transforms/SLPVectorizer/X86/alternate-int-inseltpoison.ll b/test/Transforms/SLPVectorizer/X86/alternate-int-inseltpoison.ll index 702ab0db221..8275f4a19e3 100644 --- a/test/Transforms/SLPVectorizer/X86/alternate-int-inseltpoison.ll +++ b/test/Transforms/SLPVectorizer/X86/alternate-int-inseltpoison.ll @@ -425,7 +425,7 @@ define <8 x i32> @sdiv_v8i32_undefs(<8 x i32> %a) { ; CHECK-NEXT: [[AB5:%.*]] = sdiv i32 [[A5]], 4 ; CHECK-NEXT: [[AB6:%.*]] = sdiv i32 [[A6]], 8 ; CHECK-NEXT: [[AB7:%.*]] = sdiv i32 [[A7]], 16 -; CHECK-NEXT: [[TMP1:%.*]] = insertelement <8 x i32> , i32 [[AB1]], i32 1 +; CHECK-NEXT: [[TMP1:%.*]] = insertelement <8 x i32> , i32 [[AB1]], i32 1 ; CHECK-NEXT: [[TMP2:%.*]] = insertelement <8 x i32> [[TMP1]], i32 [[AB2]], i32 2 ; CHECK-NEXT: [[R4:%.*]] = insertelement <8 x i32> [[TMP2]], i32 [[AB3]], i32 3 ; CHECK-NEXT: [[R5:%.*]] = insertelement <8 x i32> [[R4]], i32 [[AB5]], i32 5