Test Failure: Transforms/InstCombine/mul.ll

Test source: git

Log:

Source: <stdin>

----------------------------------------
define i32 @pow2_multiplier(i32 %A) {
%0:
  %B = mul i32 %A, 2
  ret i32 %B
}
=>
define i32 @pow2_multiplier(i32 %A) {
%0:
  %B = shl i32 %A, 1
  ret i32 %B
}
Transformation doesn't verify!
ERROR: Timeout


----------------------------------------
define <2 x i32> @pow2_multiplier_vec(<2 x i32> %A) {
%0:
  %B = mul <2 x i32> %A, { 8, 8 }
  ret <2 x i32> %B
}
=>
define <2 x i32> @pow2_multiplier_vec(<2 x i32> %A) {
%0:
  %B = shl <2 x i32> %A, { 3, 3 }
  ret <2 x i32> %B
}
Transformation doesn't verify!
ERROR: Timeout


----------------------------------------
define i8 @combine_shl(i8 %A) {
%0:
  %B = mul i8 %A, 8
  %C = mul i8 %B, 8
  ret i8 %C
}
=>
define i8 @combine_shl(i8 %A) {
%0:
  %C = shl i8 %A, 6
  ret i8 %C
}
Transformation seems to be correct!


----------------------------------------
define i32 @neg(i32 %i) {
%0:
  %t = mul i32 %i, 4294967295
  ret i32 %t
}
=>
define i32 @neg(i32 %i) {
%0:
  %t = sub i32 0, %i
  ret i32 %t
}
Transformation seems to be correct!


----------------------------------------
define i32 @test10(i32 %a, i32 %b) {
%0:
  %c = icmp slt i32 %a, 0
  %d = zext i1 %c to i32
  %e = mul i32 %d, %b
  ret i32 %e
}
=>
define i32 @test10(i32 %a, i32 %b) {
%0:
  %1 = ashr i32 %a, 31
  %e = and i32 %1, %b
  ret i32 %e
}
Transformation seems to be correct!


----------------------------------------
define i32 @test11(i32 %a, i32 %b) {
%0:
  %c = icmp sle i32 %a, 4294967295
  %d = zext i1 %c to i32
  %e = mul i32 %d, %b
  ret i32 %e
}
=>
define i32 @test11(i32 %a, i32 %b) {
%0:
  %1 = ashr i32 %a, 31
  %e = and i32 %1, %b
  ret i32 %e
}
Transformation seems to be correct!


----------------------------------------
define i32 @test12(i32 %a, i32 %b) {
%0:
  %c = icmp ugt i32 %a, 2147483647
  %d = zext i1 %c to i32
  %e = mul i32 %d, %b
  call void @use32(i32 %d)
  ret i32 %e
}
=>
define i32 @test12(i32 %a, i32 %b) {
%0:
  %a.lobit = lshr i32 %a, 31
  %1 = ashr i32 %a, 31
  %e = and i32 %1, %b
  call void @use32(i32 %a.lobit)
  ret i32 %e
}
Transformation seems to be correct!


----------------------------------------
define i32 @test15(i32 %A, i32 %B) {
%0:
  %shl = shl i32 1, %B
  %m = mul i32 %shl, %A
  ret i32 %m
}
=>
define i32 @test15(i32 %A, i32 %B) {
%0:
  %m = shl i32 %A, %B
  ret i32 %m
}
Transformation seems to be correct!


----------------------------------------
define i32 @mul_bool(i32 %x, i1 %y) {
%0:
  %z = zext i1 %y to i32
  %m = mul i32 %x, %z
  ret i32 %m
}
=>
define i32 @mul_bool(i32 %x, i1 %y) {
%0:
  %m = select i1 %y, i32 %x, i32 0
  ret i32 %m
}
Transformation seems to be correct!


----------------------------------------
define <2 x i32> @mul_bool_vec(<2 x i32> %x, <2 x i1> %y) {
%0:
  %z = zext <2 x i1> %y to <2 x i32>
  %m = mul <2 x i32> %x, %z
  ret <2 x i32> %m
}
=>
define <2 x i32> @mul_bool_vec(<2 x i32> %x, <2 x i1> %y) {
%0:
  %m = select <2 x i1> %y, <2 x i32> %x, <2 x i32> { 0, 0 }
  ret <2 x i32> %m
}
Transformation seems to be correct!


----------------------------------------
define <2 x i32> @mul_bool_vec_commute(<2 x i32> %x, <2 x i1> %y) {
%0:
  %z = zext <2 x i1> %y to <2 x i32>
  %m = mul <2 x i32> %z, %x
  ret <2 x i32> %m
}
=>
define <2 x i32> @mul_bool_vec_commute(<2 x i32> %x, <2 x i1> %y) {
%0:
  %m = select <2 x i1> %y, <2 x i32> %x, <2 x i32> { 0, 0 }
  ret <2 x i32> %m
}
Transformation seems to be correct!


----------------------------------------
define <3 x i7> @mul_bools(<3 x i1> %x, <3 x i1> %y) {
%0:
  %zx = zext <3 x i1> %x to <3 x i7>
  %zy = zext <3 x i1> %y to <3 x i7>
  %r = mul <3 x i7> %zx, %zy
  ret <3 x i7> %r
}
=>
define <3 x i7> @mul_bools(<3 x i1> %x, <3 x i1> %y) {
%0:
  %mulbool = and <3 x i1> %x, %y
  %r = zext <3 x i1> %mulbool to <3 x i7>
  ret <3 x i7> %r
}
Transformation seems to be correct!


----------------------------------------
define i32 @mul_bools_use1(i1 %x, i1 %y) {
%0:
  %zx = zext i1 %x to i32
  %zy = zext i1 %y to i32
  call void @use32(i32 %zy)
  %r = mul i32 %zx, %zy
  ret i32 %r
}
=>
define i32 @mul_bools_use1(i1 %x, i1 %y) {
%0:
  %zy = zext i1 %y to i32
  call void @use32(i32 %zy)
  %mulbool = and i1 %x, %y
  %r = zext i1 %mulbool to i32
  ret i32 %r
}
Transformation seems to be correct!


----------------------------------------
define i32 @mul_bools_use2(i1 %x, i1 %y) {
%0:
  %zx = zext i1 %x to i32
  %zy = zext i1 %y to i32
  call void @use32(i32 %zy)
  %r = mul i32 %zy, %zx
  ret i32 %r
}
=>
define i32 @mul_bools_use2(i1 %x, i1 %y) {
%0:
  %zy = zext i1 %y to i32
  call void @use32(i32 %zy)
  %mulbool = and i1 %y, %x
  %r = zext i1 %mulbool to i32
  ret i32 %r
}
Transformation seems to be correct!


----------------------------------------
define i32 @mul_bools_use3(i1 %x, i1 %y) {
%0:
  %zx = zext i1 %x to i32
  call void @use32(i32 %zx)
  %zy = zext i1 %y to i32
  call void @use32(i32 %zy)
  %r = mul i32 %zx, %zy
  ret i32 %r
}
=>
define i32 @mul_bools_use3(i1 %x, i1 %y) {
%0:
  %zx = zext i1 %x to i32
  call void @use32(i32 %zx)
  %zy = zext i1 %y to i32
  call void @use32(i32 %zy)
  %r = select i1 %x, i32 %zy, i32 0
  ret i32 %r
}
Transformation seems to be correct!


----------------------------------------
define <3 x i32> @mul_bools_sext(<3 x i1> %x, <3 x i1> %y) {
%0:
  %sx = sext <3 x i1> %x to <3 x i32>
  %sy = sext <3 x i1> %y to <3 x i32>
  %r = mul <3 x i32> %sx, %sy
  ret <3 x i32> %r
}
=>
define <3 x i32> @mul_bools_sext(<3 x i1> %x, <3 x i1> %y) {
%0:
  %mulbool = and <3 x i1> %x, %y
  %r = zext <3 x i1> %mulbool to <3 x i32>
  ret <3 x i32> %r
}
Transformation seems to be correct!


----------------------------------------
define i32 @mul_bools_sext_use1(i1 %x, i1 %y) {
%0:
  %sx = sext i1 %x to i32
  %sy = sext i1 %y to i32
  call void @use32(i32 %sy)
  %r = mul i32 %sx, %sy
  ret i32 %r
}
=>
define i32 @mul_bools_sext_use1(i1 %x, i1 %y) {
%0:
  %sy = sext i1 %y to i32
  call void @use32(i32 %sy)
  %mulbool = and i1 %x, %y
  %r = zext i1 %mulbool to i32
  ret i32 %r
}
Transformation seems to be correct!


----------------------------------------
define i32 @mul_bools_sext_use2(i1 %x, i1 %y) {
%0:
  %sx = sext i1 %x to i32
  %sy = sext i1 %y to i32
  call void @use32(i32 %sy)
  %r = mul i32 %sy, %sx
  ret i32 %r
}
=>
define i32 @mul_bools_sext_use2(i1 %x, i1 %y) {
%0:
  %sy = sext i1 %y to i32
  call void @use32(i32 %sy)
  %mulbool = and i1 %y, %x
  %r = zext i1 %mulbool to i32
  ret i32 %r
}
Transformation seems to be correct!


----------------------------------------
define i32 @mul_bools_sext_use3(i1 %x, i1 %y) {
%0:
  %sx = sext i1 %x to i32
  call void @use32(i32 %sx)
  %sy = sext i1 %y to i32
  call void @use32(i32 %sy)
  %r = mul i32 %sy, %sx
  ret i32 %r
}
=>
define i32 @mul_bools_sext_use3(i1 %x, i1 %y) {
%0:
  %sx = sext i1 %x to i32
  call void @use32(i32 %sx)
  %sy = sext i1 %y to i32
  call void @use32(i32 %sy)
  %r = mul nsw i32 %sy, %sx
  ret i32 %r
}
Transformation seems to be correct!


----------------------------------------
define <3 x i32> @mul_bools_mixed_ext(<3 x i1> %x, <3 x i1> %y) {
%0:
  %zx = zext <3 x i1> %x to <3 x i32>
  %sy = sext <3 x i1> %y to <3 x i32>
  %r = mul <3 x i32> %zx, %sy
  ret <3 x i32> %r
}
=>
define <3 x i32> @mul_bools_mixed_ext(<3 x i1> %x, <3 x i1> %y) {
%0:
  %mulbool = and <3 x i1> %x, %y
  %r = sext <3 x i1> %mulbool to <3 x i32>
  ret <3 x i32> %r
}
Transformation seems to be correct!


----------------------------------------
define i32 @mul_bools_mixed_ext_use1(i1 %x, i1 %y) {
%0:
  %sx = sext i1 %x to i32
  %zy = zext i1 %y to i32
  call void @use32(i32 %zy)
  %r = mul i32 %sx, %zy
  ret i32 %r
}
=>
define i32 @mul_bools_mixed_ext_use1(i1 %x, i1 %y) {
%0:
  %zy = zext i1 %y to i32
  call void @use32(i32 %zy)
  %mulbool = and i1 %x, %y
  %r = sext i1 %mulbool to i32
  ret i32 %r
}
Transformation seems to be correct!


----------------------------------------
define i32 @mul_bools_mixed_ext_use2(i1 %x, i1 %y) {
%0:
  %zx = zext i1 %x to i32
  %sy = sext i1 %y to i32
  call void @use32(i32 %sy)
  %r = mul i32 %sy, %zx
  ret i32 %r
}
=>
define i32 @mul_bools_mixed_ext_use2(i1 %x, i1 %y) {
%0:
  %sy = sext i1 %y to i32
  call void @use32(i32 %sy)
  %mulbool = and i1 %y, %x
  %r = sext i1 %mulbool to i32
  ret i32 %r
}
Transformation seems to be correct!


----------------------------------------
define i32 @mul_bools_mixed_ext_use3(i1 %x, i1 %y) {
%0:
  %sx = sext i1 %x to i32
  call void @use32(i32 %sx)
  %zy = zext i1 %y to i32
  call void @use32(i32 %zy)
  %r = mul i32 %zy, %sx
  ret i32 %r
}
=>
define i32 @mul_bools_mixed_ext_use3(i1 %x, i1 %y) {
%0:
  %sx = sext i1 %x to i32
  call void @use32(i32 %sx)
  %zy = zext i1 %y to i32
  call void @use32(i32 %zy)
  %r = select i1 %y, i32 %sx, i32 0
  ret i32 %r
}
Transformation seems to be correct!


----------------------------------------
define i32 @signbit_mul(i32 %a, i32 %b) {
%0:
  %d = lshr i32 %a, 31
  %e = mul i32 %d, %b
  ret i32 %e
}
=>
define i32 @signbit_mul(i32 %a, i32 %b) {
%0:
  %1 = ashr i32 %a, 31
  %e = and i32 %1, %b
  ret i32 %e
}
Transformation seems to be correct!


----------------------------------------
define i32 @signbit_mul_commute_extra_use(i32 %a, i32 %b) {
%0:
  %d = lshr i32 %a, 31
  %e = mul i32 %b, %d
  call void @use32(i32 %d)
  ret i32 %e
}
=>
define i32 @signbit_mul_commute_extra_use(i32 %a, i32 %b) {
%0:
  %d = lshr i32 %a, 31
  %1 = ashr i32 %a, 31
  %e = and i32 %1, %b
  call void @use32(i32 %d)
  ret i32 %e
}
Transformation seems to be correct!


----------------------------------------
define <2 x i32> @signbit_mul_vec(<2 x i32> %a, <2 x i32> %b) {
%0:
  %d = lshr <2 x i32> %a, { 31, 31 }
  %e = mul <2 x i32> %d, %b
  ret <2 x i32> %e
}
=>
define <2 x i32> @signbit_mul_vec(<2 x i32> %a, <2 x i32> %b) {
%0:
  %1 = ashr <2 x i32> %a, { 31, 31 }
  %e = and <2 x i32> %1, %b
  ret <2 x i32> %e
}
Transformation seems to be correct!


----------------------------------------
define <2 x i32> @signbit_mul_vec_commute(<2 x i32> %a, <2 x i32> %b) {
%0:
  %d = lshr <2 x i32> %a, { 31, 31 }
  %e = mul <2 x i32> %b, %d
  ret <2 x i32> %e
}
=>
define <2 x i32> @signbit_mul_vec_commute(<2 x i32> %a, <2 x i32> %b) {
%0:
  %1 = ashr <2 x i32> %a, { 31, 31 }
  %e = and <2 x i32> %1, %b
  ret <2 x i32> %e
}
Transformation seems to be correct!


----------------------------------------
define i32 @test18(i32 %A, i32 %B) {
%0:
  %C = and i32 %A, 1
  %D = and i32 %B, 1
  %E = mul i32 %C, %D
  %F = and i32 %E, 16
  ret i32 %F
}
=>
define i32 @test18(i32 %A, i32 %B) {
%0:
  ret i32 0
}
Transformation seems to be correct!


----------------------------------------
define i32 @test19(i32 %A, i32 %B) {
%0:
  %C = and i32 %A, 1
  %D = and i32 %B, 1
  %E = smul_overflow {i32, i1, i24} %C, %D
  %F = extractvalue {i32, i1, i24} %E, 0
  %G = extractvalue {i32, i1, i24} %E, 1
  call void @use(i1 %G)
  %H = and i32 %F, 16
  ret i32 %H
}
=>
define i32 @test19(i32 %A, i32 %B) {
%0:
  call void @use(i1 0)
  ret i32 0
}
Transformation seems to be correct!


----------------------------------------
define <2 x i64> @test20(<2 x i64> %A) {
%0:
  %B = add <2 x i64> %A, { 12, 14 }
  %C = mul <2 x i64> %B, { 3, 2 }
  ret <2 x i64> %C
}
=>
define <2 x i64> @test20(<2 x i64> %A) {
%0:
  %1 = mul <2 x i64> %A, { 3, 2 }
  %C = add <2 x i64> %1, { 36, 28 }
  ret <2 x i64> %C
}
Transformation seems to be correct!


----------------------------------------
define <2 x i1> @test21(<2 x i1> %A, <2 x i1> %B) {
%0:
  %C = mul <2 x i1> %A, %B
  ret <2 x i1> %C
}
=>
define <2 x i1> @test21(<2 x i1> %A, <2 x i1> %B) {
%0:
  %C = and <2 x i1> %A, %B
  ret <2 x i1> %C
}
Transformation seems to be correct!


----------------------------------------
define i32 @test22(i32 %A) {
%0:
  %B = mul nsw i32 %A, 4294967295
  ret i32 %B
}
=>
define i32 @test22(i32 %A) {
%0:
  %B = sub nsw i32 0, %A
  ret i32 %B
}
Transformation seems to be correct!


----------------------------------------
define i32 @test23(i32 %A) {
%0:
  %B = shl nuw i32 %A, 1
  %C = mul nuw i32 %B, 3
  ret i32 %C
}
=>
define i32 @test23(i32 %A) {
%0:
  %C = mul nuw i32 %A, 6
  ret i32 %C
}
Transformation seems to be correct!


----------------------------------------
define i32 @test24(i32 %A) {
%0:
  %B = shl nsw i32 %A, 1
  %C = mul nsw i32 %B, 3
  ret i32 %C
}
=>
define i32 @test24(i32 %A) {
%0:
  %C = mul nsw i32 %A, 6
  ret i32 %C
}
Transformation seems to be correct!


----------------------------------------
define i32 @neg_neg_mul(i32 %A, i32 %B) {
%0:
  %C = sub i32 0, %A
  %D = sub i32 0, %B
  %E = mul i32 %C, %D
  ret i32 %E
}
=>
define i32 @neg_neg_mul(i32 %A, i32 %B) {
%0:
  %E = mul i32 %A, %B
  ret i32 %E
}
Transformation seems to be correct!


----------------------------------------
define i32 @neg_neg_mul_nsw(i32 %A, i32 %B) {
%0:
  %C = sub nsw i32 0, %A
  %D = sub nsw i32 0, %B
  %E = mul nsw i32 %C, %D
  ret i32 %E
}
=>
define i32 @neg_neg_mul_nsw(i32 %A, i32 %B) {
%0:
  %E = mul nsw i32 %A, %B
  ret i32 %E
}
Transformation doesn't verify!
ERROR: Timeout


----------------------------------------
define i124 @neg_neg_mul_apint(i124 %A, i124 %B) {
%0:
  %C = sub i124 0, %A
  %D = sub i124 0, %B
  %E = mul i124 %C, %D
  ret i124 %E
}
=>
define i124 @neg_neg_mul_apint(i124 %A, i124 %B) {
%0:
  %E = mul i124 %A, %B
  ret i124 %E
}
Transformation doesn't verify!
ERROR: Timeout


----------------------------------------
define i32 @neg_mul_constant(i32 %A) {
%0:
  %C = sub i32 0, %A
  %E = mul i32 %C, 7
  ret i32 %E
}
=>
define i32 @neg_mul_constant(i32 %A) {
%0:
  %E = mul i32 %A, 4294967289
  ret i32 %E
}
Transformation seems to be correct!


----------------------------------------
define i55 @neg_mul_constant_apint(i55 %A) {
%0:
  %C = sub i55 0, %A
  %E = mul i55 %C, 7
  ret i55 %E
}
=>
define i55 @neg_mul_constant_apint(i55 %A) {
%0:
  %E = mul i55 %A, 36028797018963961
  ret i55 %E
}
Transformation seems to be correct!


----------------------------------------
define <3 x i8> @neg_mul_constant_vec(<3 x i8> %a) {
%0:
  %A = sub <3 x i8> { 0, 0, 0 }, %a
  %B = mul <3 x i8> %A, { 5, 5, 5 }
  ret <3 x i8> %B
}
=>
define <3 x i8> @neg_mul_constant_vec(<3 x i8> %a) {
%0:
  %B = mul <3 x i8> %a, { 251, 251, 251 }
  ret <3 x i8> %B
}
Transformation seems to be correct!


----------------------------------------
define <3 x i4> @neg_mul_constant_vec_weird(<3 x i4> %a) {
%0:
  %A = sub <3 x i4> { 0, 0, 0 }, %a
  %B = mul <3 x i4> %A, { 5, 5, 5 }
  ret <3 x i4> %B
}
=>
define <3 x i4> @neg_mul_constant_vec_weird(<3 x i4> %a) {
%0:
  %B = mul <3 x i4> %a, { 11, 11, 11 }
  ret <3 x i4> %B
}
Transformation seems to be correct!


----------------------------------------
define i32 @test26(i32 %A, i32 %B) {
%0:
  %C = shl nsw i32 1, %B
  %D = mul nsw i32 %A, %C
  ret i32 %D
}
=>
define i32 @test26(i32 %A, i32 %B) {
%0:
  %D = shl nsw i32 %A, %B
  ret i32 %D
}
Transformation seems to be correct!


----------------------------------------
define i32 @test27(i32 %A, i32 %B) {
%0:
  %C = shl i32 1, %B
  %D = mul nuw i32 %A, %C
  ret i32 %D
}
=>
define i32 @test27(i32 %A, i32 %B) {
%0:
  %D = shl nuw i32 %A, %B
  ret i32 %D
}
Transformation seems to be correct!


----------------------------------------
define i32 @test28(i32 %A) {
%0:
  %B = shl i32 1, %A
  %C = mul nsw i32 %B, %B
  ret i32 %C
}
=>
define i32 @test28(i32 %A) {
%0:
  %B = shl i32 1, %A
  %C = shl i32 %B, %A
  ret i32 %C
}
Transformation seems to be correct!


----------------------------------------
define i64 @test29(i31 %A, i31 %B) {
%0:
  %C = sext i31 %A to i64
  %D = sext i31 %B to i64
  %E = mul i64 %C, %D
  ret i64 %E
}
=>
define i64 @test29(i31 %A, i31 %B) {
%0:
  %C = sext i31 %A to i64
  %D = sext i31 %B to i64
  %E = mul nsw i64 %C, %D
  ret i64 %E
}
Transformation doesn't verify!
ERROR: Timeout


----------------------------------------
define i64 @test30(i32 %A, i32 %B) {
%0:
  %C = zext i32 %A to i64
  %D = zext i32 %B to i64
  %E = mul i64 %C, %D
  ret i64 %E
}
=>
define i64 @test30(i32 %A, i32 %B) {
%0:
  %C = zext i32 %A to i64
  %D = zext i32 %B to i64
  %E = mul nuw i64 %C, %D
  ret i64 %E
}
Transformation doesn't verify!
ERROR: Timeout


----------------------------------------
@PR22087 = global 4 bytes, align 4

define i32 @test31(i32 %V) {
%0:
  %__constexpr_3 = int2ptr i64 1 to *
  %__constexpr_2 = icmp ne * %__constexpr_3, @PR22087
  %__constexpr_1 = zext i1 %__constexpr_2 to i32
  %__constexpr_0 = shl i32 1, %__constexpr_1
  %mul = mul i32 %V, %__constexpr_0
  ret i32 %mul
}
=>
@PR22087 = global 4 bytes, align 4

define i32 @test31(i32 %V) {
%0:
  %__constexpr_2 = int2ptr i64 1 to *
  %__constexpr_1 = icmp ne * %__constexpr_2, @PR22087
  %__constexpr_0 = zext i1 %__constexpr_1 to i32
  %mul = shl i32 %V, %__constexpr_0
  ret i32 %mul
}
Transformation doesn't verify!
ERROR: Invalid expr


----------------------------------------
define i32 @test32(i32 %X) {
%0:
  %mul = mul nsw i32 %X, 2147483648
  ret i32 %mul
}
=>
define i32 @test32(i32 %X) {
%0:
  %mul = shl i32 %X, 31
  ret i32 %mul
}
Transformation seems to be correct!


----------------------------------------
define <2 x i32> @test32vec(<2 x i32> %X) {
%0:
  %mul = mul nsw <2 x i32> %X, { 2147483648, 2147483648 }
  ret <2 x i32> %mul
}
=>
define <2 x i32> @test32vec(<2 x i32> %X) {
%0:
  %mul = shl <2 x i32> %X, { 31, 31 }
  ret <2 x i32> %mul
}
Transformation seems to be correct!


----------------------------------------
define i32 @test33(i32 %X) {
%0:
  %mul = mul nsw i32 %X, 1073741824
  ret i32 %mul
}
=>
define i32 @test33(i32 %X) {
%0:
  %mul = shl nsw i32 %X, 30
  ret i32 %mul
}
Transformation seems to be correct!


----------------------------------------
define <2 x i32> @test33vec(<2 x i32> %X) {
%0:
  %mul = mul nsw <2 x i32> %X, { 1073741824, 1073741824 }
  ret <2 x i32> %mul
}
=>
define <2 x i32> @test33vec(<2 x i32> %X) {
%0:
  %mul = shl nsw <2 x i32> %X, { 30, 30 }
  ret <2 x i32> %mul
}
Transformation seems to be correct!


----------------------------------------
define i128 @test34(i128 %X) {
%0:
  %mul = mul nsw i128 %X, 2
  ret i128 %mul
}
=>
define i128 @test34(i128 %X) {
%0:
  %mul = shl nsw i128 %X, 1
  ret i128 %mul
}
Transformation doesn't verify!
ERROR: Timeout


----------------------------------------
define i32 @test_mul_canonicalize_op0(i32 %x, i32 %y) {
%0:
  %neg = sub i32 0, %x
  %mul = mul i32 %neg, %y
  ret i32 %mul
}
=>
define i32 @test_mul_canonicalize_op0(i32 %x, i32 %y) {
%0:
  %1 = mul i32 %x, %y
  %mul = sub i32 0, %1
  ret i32 %mul
}
Transformation seems to be correct!


----------------------------------------
define i32 @test_mul_canonicalize_op1(i32 %x, i32 %z) {
%0:
  %y = mul i32 %z, 3
  %neg = sub i32 0, %x
  %mul = mul i32 %y, %neg
  ret i32 %mul
}
=>
define i32 @test_mul_canonicalize_op1(i32 %x, i32 %z) {
%0:
  %y.neg = mul i32 %z, 4294967293
  %.neg = mul i32 %y.neg, %x
  ret i32 %.neg
}
Transformation seems to be correct!


----------------------------------------
define i32 @test_mul_canonicalize_nsw(i32 %x, i32 %y) {
%0:
  %neg = sub nsw i32 0, %x
  %mul = mul nsw i32 %neg, %y
  ret i32 %mul
}
=>
define i32 @test_mul_canonicalize_nsw(i32 %x, i32 %y) {
%0:
  %1 = mul i32 %x, %y
  %mul = sub i32 0, %1
  ret i32 %mul
}
Transformation doesn't verify!
ERROR: Timeout


----------------------------------------
define <2 x i32> @test_mul_canonicalize_vec(<2 x i32> %x, <2 x i32> %y) {
%0:
  %neg = sub <2 x i32> { 0, 0 }, %x
  %mul = mul <2 x i32> %neg, %y
  ret <2 x i32> %mul
}
=>
define <2 x i32> @test_mul_canonicalize_vec(<2 x i32> %x, <2 x i32> %y) {
%0:
  %1 = mul <2 x i32> %x, %y
  %mul = sub <2 x i32> { 0, 0 }, %1
  ret <2 x i32> %mul
}
Transformation seems to be correct!


----------------------------------------
define i32 @test_mul_canonicalize_multiple_uses(i32 %x, i32 %y) {
%0:
  %neg = sub i32 0, %x
  %mul = mul i32 %neg, %y
  %mul2 = mul i32 %mul, %neg
  ret i32 %mul2
}
=>
define i32 @test_mul_canonicalize_multiple_uses(i32 %x, i32 %y) {
%0:
  %neg = sub i32 0, %x
  %mul = mul i32 %neg, %y
  %mul2 = mul i32 %mul, %neg
  ret i32 %mul2
}
Transformation doesn't verify!
ERROR: Timeout


----------------------------------------
@X = global 4 bytes, align 4

define i64 @test_mul_canonicalize_neg_is_not_undone(i64 %L1) {
%0:
  %v1 = ptrtoint * @X to i64
  %B8 = sub i64 0, %v1
  %B4 = mul i64 %B8, %L1
  ret i64 %B4
}
=>
@X = global 4 bytes, align 4

define i64 @test_mul_canonicalize_neg_is_not_undone(i64 %L1) {
%0:
  %__constexpr_0 = ptrtoint * @X to i64
  %1 = mul i64 %L1, %__constexpr_0
  %B4 = sub i64 0, %1
  ret i64 %B4
}
Transformation seems to be correct!


----------------------------------------
define i32 @negate_if_true(i32 %x, i1 %cond) {
%0:
  %sel = select i1 %cond, i32 4294967295, i32 1
  %r = mul i32 %sel, %x
  ret i32 %r
}
=>
define i32 @negate_if_true(i32 %x, i1 %cond) {
%0:
  %1 = sub i32 0, %x
  %2 = select i1 %cond, i32 %1, i32 %x
  ret i32 %2
}
Transformation seems to be correct!


----------------------------------------
define i32 @negate_if_false(i32 %x, i1 %cond) {
%0:
  %sel = select i1 %cond, i32 1, i32 4294967295
  %r = mul i32 %sel, %x
  ret i32 %r
}
=>
define i32 @negate_if_false(i32 %x, i1 %cond) {
%0:
  %1 = sub i32 0, %x
  %2 = select i1 %cond, i32 %x, i32 %1
  ret i32 %2
}
Transformation seems to be correct!


----------------------------------------
define <2 x i8> @negate_if_true_commute(<2 x i8> %px, i1 %cond) {
%0:
  %x = sdiv <2 x i8> { 42, 42 }, %px
  %sel = select i1 %cond, <2 x i8> { 255, 255 }, <2 x i8> { 1, 1 }
  %r = mul <2 x i8> %x, %sel
  ret <2 x i8> %r
}
=>
define <2 x i8> @negate_if_true_commute(<2 x i8> %px, i1 %cond) {
%0:
  %x = sdiv <2 x i8> { 42, 42 }, %px
  %1 = sub nsw <2 x i8> { 0, 0 }, %x
  %2 = select i1 %cond, <2 x i8> %1, <2 x i8> %x
  ret <2 x i8> %2
}
Transformation seems to be correct!


----------------------------------------
define <2 x i8> @negate_if_false_commute(<2 x i8> %px, <2 x i1> %cond) {
%0:
  %x = sdiv <2 x i8> { 42, 5 }, %px
  %sel = select <2 x i1> %cond, <2 x i8> { 1, undef }, <2 x i8> { 255, 255 }
  %r = mul <2 x i8> %x, %sel
  ret <2 x i8> %r
}
=>
define <2 x i8> @negate_if_false_commute(<2 x i8> %px, <2 x i1> %cond) {
%0:
  %x = sdiv <2 x i8> { 42, 5 }, %px
  %1 = sub <2 x i8> { 0, 0 }, %x
  %2 = select <2 x i1> %cond, <2 x i8> %x, <2 x i8> %1
  ret <2 x i8> %2
}
Transformation seems to be correct!


----------------------------------------
define i32 @negate_if_true_extra_use(i32 %x, i1 %cond) {
%0:
  %sel = select i1 %cond, i32 4294967295, i32 1
  call void @use32(i32 %sel)
  %r = mul i32 %sel, %x
  ret i32 %r
}
=>
define i32 @negate_if_true_extra_use(i32 %x, i1 %cond) {
%0:
  %sel = select i1 %cond, i32 4294967295, i32 1
  call void @use32(i32 %sel)
  %r = mul i32 %sel, %x
  ret i32 %r
}
Transformation seems to be correct!


----------------------------------------
define <2 x i8> @negate_if_true_wrong_constant(<2 x i8> %px, i1 %cond) {
%0:
  %x = sdiv <2 x i8> { 42, 42 }, %px
  %sel = select i1 %cond, <2 x i8> { 255, 0 }, <2 x i8> { 1, 1 }
  %r = mul <2 x i8> %x, %sel
  ret <2 x i8> %r
}
=>
define <2 x i8> @negate_if_true_wrong_constant(<2 x i8> %px, i1 %cond) {
%0:
  %x = sdiv <2 x i8> { 42, 42 }, %px
  %sel = select i1 %cond, <2 x i8> { 255, 0 }, <2 x i8> { 1, 1 }
  %r = mul <2 x i8> %x, %sel
  ret <2 x i8> %r
}
Transformation seems to be correct!


----------------------------------------
define i32 @mul_div_select(i32 %x, i32 %y, i1 %c) {
%0:
  %div = udiv exact i32 %x, %y
  %sel = select i1 %c, i32 %div, i32 1
  %mul = mul i32 %sel, %y
  ret i32 %mul
}
=>
define i32 @mul_div_select(i32 %x, i32 %y, i1 %c) {
%0:
  %mul = select i1 %c, i32 %x, i32 %y
  ret i32 %mul
}
Transformation doesn't verify!
ERROR: Timeout


----------------------------------------
define i31 @combine_mul_abs_i31(i31 %0) {
%1:
  %c = icmp slt i31 %0, 0
  %s = sub nsw i31 0, %0
  %r = select i1 %c, i31 %s, i31 %0
  %m = mul i31 %r, %r
  ret i31 %m
}
=>
define i31 @combine_mul_abs_i31(i31 %0) {
%1:
  %m = mul i31 %0, %0
  ret i31 %m
}
Transformation doesn't verify!
ERROR: Timeout


----------------------------------------
define i32 @combine_mul_abs_i32(i32 %0) {
%1:
  %c = icmp slt i32 %0, 0
  %s = sub nsw i32 0, %0
  %r = select i1 %c, i32 %s, i32 %0
  %m = mul i32 %r, %r
  ret i32 %m
}
=>
define i32 @combine_mul_abs_i32(i32 %0) {
%1:
  %m = mul i32 %0, %0
  ret i32 %m
}
Transformation doesn't verify!
ERROR: Timeout


----------------------------------------
define <4 x i32> @combine_mul_abs_v4i32(<4 x i32> %0) {
%1:
  %c = icmp slt <4 x i32> %0, { 0, 0, 0, 0 }
  %s = sub nsw <4 x i32> { 0, 0, 0, 0 }, %0
  %r = select <4 x i1> %c, <4 x i32> %s, <4 x i32> %0
  %m = mul <4 x i32> %r, %r
  ret <4 x i32> %m
}
=>
define <4 x i32> @combine_mul_abs_v4i32(<4 x i32> %0) {
%1:
  %m = mul <4 x i32> %0, %0
  ret <4 x i32> %m
}
Transformation doesn't verify!
ERROR: Timeout


----------------------------------------
define i31 @combine_mul_nabs_i31(i31 %0) {
%1:
  %c = icmp slt i31 %0, 0
  %s = sub nsw i31 0, %0
  %r = select i1 %c, i31 %0, i31 %s
  %m = mul i31 %r, %r
  ret i31 %m
}
=>
define i31 @combine_mul_nabs_i31(i31 %0) {
%1:
  %m = mul i31 %0, %0
  ret i31 %m
}
Transformation doesn't verify!
ERROR: Timeout


----------------------------------------
define i32 @combine_mul_nabs_i32(i32 %0) {
%1:
  %c = icmp slt i32 %0, 0
  %s = sub nsw i32 0, %0
  %r = select i1 %c, i32 %0, i32 %s
  %m = mul i32 %r, %r
  ret i32 %m
}
=>
define i32 @combine_mul_nabs_i32(i32 %0) {
%1:
  %m = mul i32 %0, %0
  ret i32 %m
}
Transformation doesn't verify!
ERROR: Timeout


----------------------------------------
define <4 x i32> @combine_mul_nabs_v4i32(<4 x i32> %0) {
%1:
  %c = icmp slt <4 x i32> %0, { 0, 0, 0, 0 }
  %s = sub nsw <4 x i32> { 0, 0, 0, 0 }, %0
  %r = select <4 x i1> %c, <4 x i32> %0, <4 x i32> %s
  %m = mul <4 x i32> %r, %r
  ret <4 x i32> %m
}
=>
define <4 x i32> @combine_mul_nabs_v4i32(<4 x i32> %0) {
%1:
  %m = mul <4 x i32> %0, %0
  ret <4 x i32> %m
}
Transformation doesn't verify!
ERROR: Timeout

ERROR: Unsupported type: <vscale x 2 x i64>
ERROR: Unsupported type: <vscale x 2 x i64>

----------------------------------------
define i32 @mulsub1(i32 %a0, i32 %a1) {
%0:
  %sub = sub i32 %a1, %a0
  %mul = mul i32 %sub, 4294967292
  ret i32 %mul
}
=>
define i32 @mulsub1(i32 %a0, i32 %a1) {
%0:
  %sub.neg = sub i32 %a0, %a1
  %mul = shl i32 %sub.neg, 2
  ret i32 %mul
}
Transformation doesn't verify!
ERROR: Timeout


----------------------------------------
define <2 x i32> @mulsub1_vec(<2 x i32> %a0, <2 x i32> %a1) {
%0:
  %sub = sub <2 x i32> %a1, %a0
  %mul = mul <2 x i32> %sub, { 4294967292, 4294967292 }
  ret <2 x i32> %mul
}
=>
define <2 x i32> @mulsub1_vec(<2 x i32> %a0, <2 x i32> %a1) {
%0:
  %sub.neg = sub <2 x i32> %a0, %a1
  %mul = shl <2 x i32> %sub.neg, { 2, 2 }
  ret <2 x i32> %mul
}
Transformation doesn't verify!
ERROR: Timeout


----------------------------------------
define <2 x i32> @mulsub1_vec_nonuniform(<2 x i32> %a0, <2 x i32> %a1) {
%0:
  %sub = sub <2 x i32> %a1, %a0
  %mul = mul <2 x i32> %sub, { 4294967292, 4294967288 }
  ret <2 x i32> %mul
}
=>
define <2 x i32> @mulsub1_vec_nonuniform(<2 x i32> %a0, <2 x i32> %a1) {
%0:
  %sub.neg = sub <2 x i32> %a0, %a1
  %mul = shl <2 x i32> %sub.neg, { 2, 3 }
  ret <2 x i32> %mul
}
Transformation doesn't verify!
ERROR: Timeout


----------------------------------------
define <2 x i32> @mulsub1_vec_nonuniform_undef(<2 x i32> %a0, <2 x i32> %a1) {
%0:
  %sub = sub <2 x i32> %a1, %a0
  %mul = mul <2 x i32> %sub, { 4294967292, undef }
  ret <2 x i32> %mul
}
=>
define <2 x i32> @mulsub1_vec_nonuniform_undef(<2 x i32> %a0, <2 x i32> %a1) {
%0:
  %sub.neg = sub <2 x i32> %a0, %a1
  %mul = shl <2 x i32> %sub.neg, { 2, undef }
  ret <2 x i32> %mul
}
Transformation doesn't verify!
ERROR: Target is more poisonous than source

Example:
<2 x i32> %a0 = < undef, undef >
<2 x i32> %a1 = < undef, undef >

Source:
<2 x i32> %sub = < undef, undef >
<2 x i32> %mul = < #x00000000 (0), #x00000000 (0) >

Target:
<2 x i32> %sub.neg = < #x00000000 (0), #x00000000 (0) >
<2 x i32> %mul = < #x00000000 (0), poison >
Source value: < #x00000000 (0), #x00000000 (0) >
Target value: < #x00000000 (0), poison >


------------------- SMT STATS -------------------
Num queries: 199
Num invalid: 1
Num skips:   0
Num trivial: 232 (53.8%)
Num timeout: 19 (9.5%)
Num errors:  0 (0.0%)
Num SAT:     77 (38.7%)
Num UNSAT:   103 (51.8%)

stderr:

+ : 'RUN: at line 2'
+ /home/nlopes/alive2/scripts/opt-alive.sh -instcombine -S
+ /home/nlopes/llvm/build/bin/FileCheck /home/nlopes/llvm/llvm/test/Transforms/InstCombine/mul.ll

Alive2: Transform doesn't verify; aborting!
FileCheck error: '<stdin>' is empty.
FileCheck command line:  /home/nlopes/llvm/build/bin/FileCheck /home/nlopes/llvm/llvm/test/Transforms/InstCombine/mul.ll

 

<-- Back