Test Failure: Transforms/InstCombine/minmax-fold.ll

Test source: git

Log:

Source: <stdin>

----------------------------------------
define i64 @t1(i32 %a) {
%0:
  %1 = icmp slt i32 %a, 5
  %2 = select i1 %1, i32 %a, i32 5
  %3 = sext i32 %2 to i64
  ret i64 %3
}
=>
define i64 @t1(i32 %a) {
%0:
  %1 = icmp slt i32 %a, 5
  %2 = select i1 %1, i32 %a, i32 5
  %3 = sext i32 %2 to i64
  ret i64 %3
}
Transformation seems to be correct!


----------------------------------------
define i64 @t2(i32 %a) {
%0:
  %1 = icmp slt i32 %a, 5
  %2 = sext i32 %a to i64
  %3 = select i1 %1, i64 %2, i64 5
  ret i64 %3
}
=>
define i64 @t2(i32 %a) {
%0:
  %1 = icmp slt i32 %a, 5
  %narrow = select i1 %1, i32 %a, i32 5
  %2 = sext i32 %narrow to i64
  ret i64 %2
}
Transformation seems to be correct!


----------------------------------------
define i64 @t3(i32 %a) {
%0:
  %1 = icmp ult i32 %a, 5
  %2 = zext i32 %a to i64
  %3 = select i1 %1, i64 5, i64 %2
  ret i64 %3
}
=>
define i64 @t3(i32 %a) {
%0:
  %1 = icmp ugt i32 %a, 5
  %narrow = select i1 %1, i32 %a, i32 5
  %2 = zext i32 %narrow to i64
  ret i64 %2
}
Transformation seems to be correct!


----------------------------------------
define i32 @t4(i64 %a) {
%0:
  %1 = icmp slt i64 %a, 5
  %2 = trunc i64 %a to i32
  %3 = select i1 %1, i32 %2, i32 5
  ret i32 %3
}
=>
define i32 @t4(i64 %a) {
%0:
  %1 = icmp slt i64 %a, 5
  %2 = select i1 %1, i64 %a, i64 5
  %3 = trunc i64 %2 to i32
  ret i32 %3
}
Transformation doesn't verify!
ERROR: Timeout


----------------------------------------
define i64 @t5(i32 %a) {
%0:
  %1 = icmp slt i32 %a, 5
  %2 = zext i32 %a to i64
  %3 = select i1 %1, i64 5, i64 %2
  ret i64 %3
}
=>
define i64 @t5(i32 %a) {
%0:
  %1 = icmp sgt i32 %a, 5
  %narrow = select i1 %1, i32 %a, i32 5
  %2 = zext i32 %narrow to i64
  ret i64 %2
}
Transformation seems to be correct!


----------------------------------------
define float @t6(i32 %a) {
%0:
  %1 = icmp slt i32 %a, 0
  %2 = select i1 %1, i32 %a, i32 0
  %3 = sitofp i32 %2 to float
  ret float %3
}
=>
define float @t6(i32 %a) {
%0:
  %1 = icmp slt i32 %a, 0
  %2 = select i1 %1, i32 %a, i32 0
  %3 = sitofp i32 %2 to float
  ret float %3
}
Transformation seems to be correct!


----------------------------------------
define i16 @t7(i32 %a) {
%0:
  %1 = icmp slt i32 %a, 4294934528
  %2 = trunc i32 %a to i16
  %3 = select i1 %1, i16 %2, i16 32768
  ret i16 %3
}
=>
define i16 @t7(i32 %a) {
%0:
  %1 = icmp slt i32 %a, 4294934528
  %2 = select i1 %1, i32 %a, i32 4294934528
  %3 = trunc i32 %2 to i16
  ret i16 %3
}
Transformation doesn't verify!
ERROR: Timeout


----------------------------------------
define i32 @t8(i64 %a, i32 %b) {
%0:
  %1 = icmp slt i64 %a, -32767
  %2 = select i1 %1, i64 %a, i64 -32767
  %3 = trunc i64 %2 to i32
  %4 = icmp slt i32 %b, 42
  %5 = select i1 %4, i32 42, i32 %3
  %6 = icmp ne i32 %5, %b
  %7 = zext i1 %6 to i32
  ret i32 %7
}
=>
define i32 @t8(i64 %a, i32 %b) {
%0:
  %1 = icmp slt i64 %a, -32767
  %2 = select i1 %1, i64 %a, i64 -32767
  %3 = trunc i64 %2 to i32
  %4 = icmp slt i32 %b, 42
  %5 = select i1 %4, i32 42, i32 %3
  %6 = icmp ne i32 %5, %b
  %7 = zext i1 %6 to i32
  ret i32 %7
}
Transformation doesn't verify!
ERROR: Timeout


----------------------------------------
define i64 @t9(i32 %a) {
%0:
  %1 = icmp sgt i32 %a, 4294967295
  %2 = sext i32 %a to i64
  %3 = select i1 %1, i64 %2, i64 4294967295
  ret i64 %3
}
=>
define i64 @t9(i32 %a) {
%0:
  %1 = icmp sgt i32 %a, 4294967295
  %2 = sext i32 %a to i64
  %3 = select i1 %1, i64 %2, i64 4294967295
  ret i64 %3
}
Transformation seems to be correct!


----------------------------------------
define float @t10(i32 %x) {
%0:
  %f_x = sitofp i32 %x to float
  %cmp = icmp sgt i32 %x, 255
  %r = select i1 %cmp, float %f_x, float 255.000000
  ret float %r
}
=>
define float @t10(i32 %x) {
%0:
  %1 = icmp sgt i32 %x, 255
  %r1 = select i1 %1, i32 %x, i32 255
  %2 = sitofp i32 %r1 to float
  ret float %2
}
Transformation seems to be correct!


----------------------------------------
define float @t11(i64 %x) {
%0:
  %f_x = sitofp i64 %x to float
  %cmp = icmp sgt i64 %x, 255
  %r = select i1 %cmp, float %f_x, float 255.000000
  ret float %r
}
=>
define float @t11(i64 %x) {
%0:
  %1 = icmp sgt i64 %x, 255
  %r1 = select i1 %1, i64 %x, i64 255
  %2 = sitofp i64 %r1 to float
  ret float %2
}
Transformation seems to be correct!


----------------------------------------
define <4 x i32> @bitcasts_fcmp_1(<2 x i64> %a, <2 x i64> %b) {
%0:
  %t0 = bitcast <2 x i64> %a to <4 x float>
  %t1 = bitcast <2 x i64> %b to <4 x float>
  %t2 = fcmp olt <4 x float> %t1, %t0
  %t3 = bitcast <2 x i64> %a to <4 x i32>
  %t4 = bitcast <2 x i64> %b to <4 x i32>
  %t5 = select <4 x i1> %t2, <4 x i32> %t3, <4 x i32> %t4
  ret <4 x i32> %t5
}
=>
define <4 x i32> @bitcasts_fcmp_1(<2 x i64> %a, <2 x i64> %b) {
%0:
  %t0 = bitcast <2 x i64> %a to <4 x float>
  %t1 = bitcast <2 x i64> %b to <4 x float>
  %t2 = fcmp olt <4 x float> %t1, %t0
  %1 = select <4 x i1> %t2, <4 x float> %t0, <4 x float> %t1
  %t5 = bitcast <4 x float> %1 to <4 x i32>
  ret <4 x i32> %t5
}
Transformation doesn't verify!
ERROR: Timeout


----------------------------------------
define <4 x i32> @bitcasts_fcmp_2(<2 x i64> %a, <2 x i64> %b) {
%0:
  %t0 = bitcast <2 x i64> %a to <4 x float>
  %t1 = bitcast <2 x i64> %b to <4 x float>
  %t2 = fcmp olt <4 x float> %t0, %t1
  %t3 = bitcast <2 x i64> %a to <4 x i32>
  %t4 = bitcast <2 x i64> %b to <4 x i32>
  %t5 = select <4 x i1> %t2, <4 x i32> %t3, <4 x i32> %t4
  ret <4 x i32> %t5
}
=>
define <4 x i32> @bitcasts_fcmp_2(<2 x i64> %a, <2 x i64> %b) {
%0:
  %t0 = bitcast <2 x i64> %a to <4 x float>
  %t1 = bitcast <2 x i64> %b to <4 x float>
  %t2 = fcmp olt <4 x float> %t0, %t1
  %1 = select <4 x i1> %t2, <4 x float> %t0, <4 x float> %t1
  %t5 = bitcast <4 x float> %1 to <4 x i32>
  ret <4 x i32> %t5
}
Transformation doesn't verify!
ERROR: Timeout


----------------------------------------
define <4 x float> @bitcasts_icmp(<2 x i64> %a, <2 x i64> %b) {
%0:
  %t0 = bitcast <2 x i64> %a to <4 x i32>
  %t1 = bitcast <2 x i64> %b to <4 x i32>
  %t2 = icmp slt <4 x i32> %t1, %t0
  %t3 = bitcast <2 x i64> %a to <4 x float>
  %t4 = bitcast <2 x i64> %b to <4 x float>
  %t5 = select <4 x i1> %t2, <4 x float> %t3, <4 x float> %t4
  ret <4 x float> %t5
}
=>
define <4 x float> @bitcasts_icmp(<2 x i64> %a, <2 x i64> %b) {
%0:
  %t0 = bitcast <2 x i64> %a to <4 x i32>
  %t1 = bitcast <2 x i64> %b to <4 x i32>
  %t2 = icmp slt <4 x i32> %t1, %t0
  %1 = select <4 x i1> %t2, <4 x i32> %t0, <4 x i32> %t1
  %t5 = bitcast <4 x i32> %1 to <4 x float>
  ret <4 x float> %t5
}
Transformation doesn't verify!
ERROR: Timeout


----------------------------------------
define i32 @test68(i32 %x) {
%0:
  %cmp = icmp slt i32 11, %x
  %cond = select i1 %cmp, i32 11, i32 %x
  %cmp3 = icmp slt i32 92, %cond
  %retval = select i1 %cmp3, i32 92, i32 %cond
  ret i32 %retval
}
=>
define i32 @test68(i32 %x) {
%0:
  %1 = icmp slt i32 %x, 11
  %cond = select i1 %1, i32 %x, i32 11
  ret i32 %cond
}
Transformation seems to be correct!


----------------------------------------
define <2 x i32> @test68vec(<2 x i32> %x) {
%0:
  %cmp = icmp slt <2 x i32> { 11, 11 }, %x
  %cond = select <2 x i1> %cmp, <2 x i32> { 11, 11 }, <2 x i32> %x
  %cmp3 = icmp slt <2 x i32> { 92, 92 }, %cond
  %retval = select <2 x i1> %cmp3, <2 x i32> { 92, 92 }, <2 x i32> %cond
  ret <2 x i32> %retval
}
=>
define <2 x i32> @test68vec(<2 x i32> %x) {
%0:
  %1 = icmp slt <2 x i32> %x, { 11, 11 }
  %cond = select <2 x i1> %1, <2 x i32> %x, <2 x i32> { 11, 11 }
  ret <2 x i32> %cond
}
Transformation seems to be correct!


----------------------------------------
define i32 @test69(i32 %x) {
%0:
  %cmp = icmp ult i32 24, %x
  %cond = select i1 %cmp, i32 24, i32 %x
  %cmp3 = icmp ult i32 83, %cond
  %retval = select i1 %cmp3, i32 83, i32 %cond
  ret i32 %retval
}
=>
define i32 @test69(i32 %x) {
%0:
  %1 = icmp ult i32 %x, 24
  %cond = select i1 %1, i32 %x, i32 24
  ret i32 %cond
}
Transformation seems to be correct!


----------------------------------------
define i32 @test70(i32 %x) {
%0:
  %cmp = icmp slt i32 %x, 75
  %cond = select i1 %cmp, i32 75, i32 %x
  %cmp3 = icmp slt i32 %cond, 36
  %retval = select i1 %cmp3, i32 36, i32 %cond
  ret i32 %retval
}
=>
define i32 @test70(i32 %x) {
%0:
  %1 = icmp sgt i32 %x, 75
  %cond = select i1 %1, i32 %x, i32 75
  ret i32 %cond
}
Transformation seems to be correct!


----------------------------------------
define i32 @test71(i32 %x) {
%0:
  %cmp = icmp ult i32 %x, 68
  %cond = select i1 %cmp, i32 68, i32 %x
  %cmp3 = icmp ult i32 %cond, 47
  %retval = select i1 %cmp3, i32 47, i32 %cond
  ret i32 %retval
}
=>
define i32 @test71(i32 %x) {
%0:
  %1 = icmp ugt i32 %x, 68
  %cond = select i1 %1, i32 %x, i32 68
  ret i32 %cond
}
Transformation seems to be correct!


----------------------------------------
define i32 @test72(i32 %x) {
%0:
  %cmp = icmp sgt i32 %x, 92
  %cond = select i1 %cmp, i32 92, i32 %x
  %cmp3 = icmp sgt i32 %cond, 11
  %retval = select i1 %cmp3, i32 11, i32 %cond
  ret i32 %retval
}
=>
define i32 @test72(i32 %x) {
%0:
  %1 = icmp slt i32 %x, 11
  %retval = select i1 %1, i32 %x, i32 11
  ret i32 %retval
}
Transformation seems to be correct!


----------------------------------------
define <2 x i32> @test72vec(<2 x i32> %x) {
%0:
  %cmp = icmp sgt <2 x i32> %x, { 92, 92 }
  %cond = select <2 x i1> %cmp, <2 x i32> { 92, 92 }, <2 x i32> %x
  %cmp3 = icmp sgt <2 x i32> %cond, { 11, 11 }
  %retval = select <2 x i1> %cmp3, <2 x i32> { 11, 11 }, <2 x i32> %cond
  ret <2 x i32> %retval
}
=>
define <2 x i32> @test72vec(<2 x i32> %x) {
%0:
  %1 = icmp slt <2 x i32> %x, { 11, 11 }
  %retval = select <2 x i1> %1, <2 x i32> %x, <2 x i32> { 11, 11 }
  ret <2 x i32> %retval
}
Transformation seems to be correct!


----------------------------------------
define i32 @test73(i32 %x) {
%0:
  %cmp = icmp ugt i32 %x, 83
  %cond = select i1 %cmp, i32 83, i32 %x
  %cmp3 = icmp ugt i32 %cond, 24
  %retval = select i1 %cmp3, i32 24, i32 %cond
  ret i32 %retval
}
=>
define i32 @test73(i32 %x) {
%0:
  %1 = icmp ult i32 %x, 24
  %retval = select i1 %1, i32 %x, i32 24
  ret i32 %retval
}
Transformation seems to be correct!


----------------------------------------
define i32 @test74(i32 %x) {
%0:
  %cmp = icmp slt i32 %x, 36
  %cond = select i1 %cmp, i32 36, i32 %x
  %cmp3 = icmp slt i32 %cond, 75
  %retval = select i1 %cmp3, i32 75, i32 %cond
  ret i32 %retval
}
=>
define i32 @test74(i32 %x) {
%0:
  %1 = icmp sgt i32 %x, 75
  %retval = select i1 %1, i32 %x, i32 75
  ret i32 %retval
}
Transformation seems to be correct!


----------------------------------------
define i32 @test75(i32 %x) {
%0:
  %cmp = icmp ult i32 %x, 47
  %cond = select i1 %cmp, i32 47, i32 %x
  %cmp3 = icmp ult i32 %cond, 68
  %retval = select i1 %cmp3, i32 68, i32 %cond
  ret i32 %retval
}
=>
define i32 @test75(i32 %x) {
%0:
  %1 = icmp ugt i32 %x, 68
  %retval = select i1 %1, i32 %x, i32 68
  ret i32 %retval
}
Transformation seems to be correct!


----------------------------------------
define i32 @clamp_signed1(i32 %x) {
%0:
  %cmp2 = icmp slt i32 %x, 255
  %min = select i1 %cmp2, i32 %x, i32 255
  %cmp1 = icmp slt i32 %x, 15
  %r = select i1 %cmp1, i32 15, i32 %min
  ret i32 %r
}
=>
define i32 @clamp_signed1(i32 %x) {
%0:
  %cmp2 = icmp slt i32 %x, 255
  %min = select i1 %cmp2, i32 %x, i32 255
  %1 = icmp sgt i32 %min, 15
  %r = select i1 %1, i32 %min, i32 15
  ret i32 %r
}
Transformation seems to be correct!


----------------------------------------
define i32 @clamp_signed2(i32 %x) {
%0:
  %cmp2 = icmp sgt i32 %x, 15
  %max = select i1 %cmp2, i32 %x, i32 15
  %cmp1 = icmp sgt i32 %x, 255
  %r = select i1 %cmp1, i32 255, i32 %max
  ret i32 %r
}
=>
define i32 @clamp_signed2(i32 %x) {
%0:
  %cmp2 = icmp sgt i32 %x, 15
  %max = select i1 %cmp2, i32 %x, i32 15
  %1 = icmp slt i32 %max, 255
  %r = select i1 %1, i32 %max, i32 255
  ret i32 %r
}
Transformation seems to be correct!


----------------------------------------
define i32 @clamp_signed3(i32 %x) {
%0:
  %cmp2 = icmp slt i32 %x, 255
  %min = select i1 %cmp2, i32 %x, i32 255
  %cmp1 = icmp sgt i32 %x, 15
  %r = select i1 %cmp1, i32 %min, i32 15
  ret i32 %r
}
=>
define i32 @clamp_signed3(i32 %x) {
%0:
  %cmp2 = icmp slt i32 %x, 255
  %min = select i1 %cmp2, i32 %x, i32 255
  %1 = icmp sgt i32 %min, 15
  %r = select i1 %1, i32 %min, i32 15
  ret i32 %r
}
Transformation seems to be correct!


----------------------------------------
define i32 @clamp_signed4(i32 %x) {
%0:
  %cmp2 = icmp sgt i32 %x, 15
  %max = select i1 %cmp2, i32 %x, i32 15
  %cmp1 = icmp slt i32 %x, 255
  %r = select i1 %cmp1, i32 %max, i32 255
  ret i32 %r
}
=>
define i32 @clamp_signed4(i32 %x) {
%0:
  %cmp2 = icmp sgt i32 %x, 15
  %max = select i1 %cmp2, i32 %x, i32 15
  %1 = icmp slt i32 %max, 255
  %r = select i1 %1, i32 %max, i32 255
  ret i32 %r
}
Transformation seems to be correct!


----------------------------------------
define i32 @clamp_unsigned1(i32 %x) {
%0:
  %cmp2 = icmp ult i32 %x, 255
  %min = select i1 %cmp2, i32 %x, i32 255
  %cmp1 = icmp ult i32 %x, 15
  %r = select i1 %cmp1, i32 15, i32 %min
  ret i32 %r
}
=>
define i32 @clamp_unsigned1(i32 %x) {
%0:
  %cmp2 = icmp ult i32 %x, 255
  %min = select i1 %cmp2, i32 %x, i32 255
  %1 = icmp ugt i32 %min, 15
  %r = select i1 %1, i32 %min, i32 15
  ret i32 %r
}
Transformation seems to be correct!


----------------------------------------
define i32 @clamp_unsigned2(i32 %x) {
%0:
  %cmp2 = icmp ugt i32 %x, 15
  %max = select i1 %cmp2, i32 %x, i32 15
  %cmp1 = icmp ugt i32 %x, 255
  %r = select i1 %cmp1, i32 255, i32 %max
  ret i32 %r
}
=>
define i32 @clamp_unsigned2(i32 %x) {
%0:
  %cmp2 = icmp ugt i32 %x, 15
  %max = select i1 %cmp2, i32 %x, i32 15
  %1 = icmp ult i32 %max, 255
  %r = select i1 %1, i32 %max, i32 255
  ret i32 %r
}
Transformation seems to be correct!


----------------------------------------
define i32 @clamp_unsigned3(i32 %x) {
%0:
  %cmp2 = icmp ult i32 %x, 255
  %min = select i1 %cmp2, i32 %x, i32 255
  %cmp1 = icmp ugt i32 %x, 15
  %r = select i1 %cmp1, i32 %min, i32 15
  ret i32 %r
}
=>
define i32 @clamp_unsigned3(i32 %x) {
%0:
  %cmp2 = icmp ult i32 %x, 255
  %min = select i1 %cmp2, i32 %x, i32 255
  %1 = icmp ugt i32 %min, 15
  %r = select i1 %1, i32 %min, i32 15
  ret i32 %r
}
Transformation seems to be correct!


----------------------------------------
define i32 @clamp_unsigned4(i32 %x) {
%0:
  %cmp2 = icmp ugt i32 %x, 15
  %max = select i1 %cmp2, i32 %x, i32 15
  %cmp1 = icmp ult i32 %x, 255
  %r = select i1 %cmp1, i32 %max, i32 255
  ret i32 %r
}
=>
define i32 @clamp_unsigned4(i32 %x) {
%0:
  %cmp2 = icmp ugt i32 %x, 15
  %max = select i1 %cmp2, i32 %x, i32 15
  %1 = icmp ult i32 %max, 255
  %r = select i1 %1, i32 %max, i32 255
  ret i32 %r
}
Transformation seems to be correct!


----------------------------------------
define i32 @clamp_check_for_no_infinite_loop1(i32 %i) {
%0:
  %cmp1 = icmp slt i32 %i, 255
  %sel1 = select i1 %cmp1, i32 %i, i32 255
  %cmp2 = icmp slt i32 %i, 0
  %res = select i1 %cmp2, i32 0, i32 %sel1
  ret i32 %res
}
=>
define i32 @clamp_check_for_no_infinite_loop1(i32 %i) {
%0:
  %cmp1 = icmp slt i32 %i, 255
  %sel1 = select i1 %cmp1, i32 %i, i32 255
  %1 = icmp sgt i32 %sel1, 0
  %res = select i1 %1, i32 %sel1, i32 0
  ret i32 %res
}
Transformation seems to be correct!


----------------------------------------
define i32 @clamp_check_for_no_infinite_loop2(i32 %i) {
%0:
  %cmp1 = icmp sgt i32 %i, 4294967041
  %sel1 = select i1 %cmp1, i32 %i, i32 4294967041
  %cmp2 = icmp slt i32 %i, 0
  %res = select i1 %cmp2, i32 %sel1, i32 0
  ret i32 %res
}
=>
define i32 @clamp_check_for_no_infinite_loop2(i32 %i) {
%0:
  %cmp1 = icmp sgt i32 %i, 4294967041
  %sel1 = select i1 %cmp1, i32 %i, i32 4294967041
  %1 = icmp slt i32 %sel1, 0
  %res = select i1 %1, i32 %sel1, i32 0
  ret i32 %res
}
Transformation seems to be correct!


----------------------------------------
define i32 @clamp_check_for_no_infinite_loop3(i32 %i) {
%0:
  %i2 = icmp sgt i32 %i, 1
  %i3 = select i1 %i2, i32 %i, i32 1
  %i4 = icmp sgt i32 %i3, 0
  br i1 %i4, label %truelabel, label %falselabel

%falselabel:
  ret i32 0

%truelabel:
  %i5 = icmp slt i32 %i3, 2
  %i6 = select i1 %i5, i32 %i3, i32 2
  %i7 = shl nsw nuw i32 %i6, 2
  ret i32 %i7
}
=>
define i32 @clamp_check_for_no_infinite_loop3(i32 %i) {
%0:
  %i2 = icmp sgt i32 %i, 1
  %i3 = select i1 %i2, i32 %i, i32 1
  br i1 1, label %truelabel, label %falselabel

%falselabel:
  ret i32 0

%truelabel:
  %i5 = icmp slt i32 %i3, 2
  %i6 = select i1 %i5, i32 %i3, i32 2
  %i7 = shl nsw nuw i32 %i6, 2
  ret i32 %i7
}
Transformation seems to be correct!


----------------------------------------
define double @PR31751_umin1(i32 %x) {
%0:
  %cmp = icmp slt i32 %x, 0
  %sel = select i1 %cmp, i32 2147483647, i32 %x
  %conv = sitofp i32 %sel to double
  ret double %conv
}
=>
define double @PR31751_umin1(i32 %x) {
%0:
  %1 = icmp ult i32 %x, 2147483647
  %sel = select i1 %1, i32 %x, i32 2147483647
  %conv = sitofp i32 %sel to double
  ret double %conv
}
Transformation seems to be correct!


----------------------------------------
define double @PR31751_umin2(i32 %x) {
%0:
  %cmp = icmp ult i32 %x, 2147483647
  %sel = select i1 %cmp, i32 %x, i32 2147483647
  %conv = sitofp i32 %sel to double
  ret double %conv
}
=>
define double @PR31751_umin2(i32 %x) {
%0:
  %cmp = icmp ult i32 %x, 2147483647
  %sel = select i1 %cmp, i32 %x, i32 2147483647
  %conv = sitofp i32 %sel to double
  ret double %conv
}
Transformation seems to be correct!


----------------------------------------
define double @PR31751_umin3(i32 %x) {
%0:
  %cmp = icmp ugt i32 %x, 2147483647
  %sel = select i1 %cmp, i32 2147483647, i32 %x
  %conv = sitofp i32 %sel to double
  ret double %conv
}
=>
define double @PR31751_umin3(i32 %x) {
%0:
  %1 = icmp ult i32 %x, 2147483647
  %sel = select i1 %1, i32 %x, i32 2147483647
  %conv = sitofp i32 %sel to double
  ret double %conv
}
Transformation seems to be correct!


----------------------------------------
define double @PR31751_umax1(i32 %x) {
%0:
  %cmp = icmp sgt i32 %x, 4294967295
  %sel = select i1 %cmp, i32 2147483648, i32 %x
  %conv = sitofp i32 %sel to double
  ret double %conv
}
=>
define double @PR31751_umax1(i32 %x) {
%0:
  %1 = icmp ugt i32 %x, 2147483648
  %sel = select i1 %1, i32 %x, i32 2147483648
  %conv = sitofp i32 %sel to double
  ret double %conv
}
Transformation seems to be correct!


----------------------------------------
define double @PR31751_umax2(i32 %x) {
%0:
  %cmp = icmp ugt i32 %x, 2147483648
  %sel = select i1 %cmp, i32 %x, i32 2147483648
  %conv = sitofp i32 %sel to double
  ret double %conv
}
=>
define double @PR31751_umax2(i32 %x) {
%0:
  %cmp = icmp ugt i32 %x, 2147483648
  %sel = select i1 %cmp, i32 %x, i32 2147483648
  %conv = sitofp i32 %sel to double
  ret double %conv
}
Transformation seems to be correct!


----------------------------------------
define double @PR31751_umax3(i32 %x) {
%0:
  %cmp = icmp ult i32 %x, 2147483648
  %sel = select i1 %cmp, i32 2147483648, i32 %x
  %conv = sitofp i32 %sel to double
  ret double %conv
}
=>
define double @PR31751_umax3(i32 %x) {
%0:
  %1 = icmp ugt i32 %x, 2147483648
  %sel = select i1 %1, i32 %x, i32 2147483648
  %conv = sitofp i32 %sel to double
  ret double %conv
}
Transformation seems to be correct!


----------------------------------------
define float @bitcast_scalar_smax(float %x, float %y) {
%0:
  %bcx = bitcast float %x to i32
  %bcy = bitcast float %y to i32
  %cmp = icmp sgt i32 %bcx, %bcy
  %sel = select i1 %cmp, i32 %bcx, i32 %bcy
  %bcs = bitcast i32 %sel to float
  ret float %bcs
}
=>
define float @bitcast_scalar_smax(float %x, float %y) {
%0:
  %bcx = bitcast float %x to i32
  %bcy = bitcast float %y to i32
  %cmp = icmp sgt i32 %bcx, %bcy
  %sel = select i1 %cmp, i32 %bcx, i32 %bcy
  %bcs = bitcast i32 %sel to float
  ret float %bcs
}
Transformation seems to be correct!


----------------------------------------
define float @bitcast_scalar_umax(float %x, float %y) {
%0:
  %bcx = bitcast float %x to i32
  %bcy = bitcast float %y to i32
  %cmp = icmp ugt i32 %bcx, %bcy
  %sel = select i1 %cmp, float %x, float %y
  ret float %sel
}
=>
define float @bitcast_scalar_umax(float %x, float %y) {
%0:
  %bcx = bitcast float %x to i32
  %bcy = bitcast float %y to i32
  %cmp = icmp ugt i32 %bcx, %bcy
  %sel = select i1 %cmp, float %x, float %y
  ret float %sel
}
Transformation seems to be correct!


----------------------------------------
define <8 x float> @bitcast_vector_smin(<8 x float> %x, <8 x float> %y) {
%0:
  %bcx = bitcast <8 x float> %x to <8 x i32>
  %bcy = bitcast <8 x float> %y to <8 x i32>
  %cmp = icmp slt <8 x i32> %bcx, %bcy
  %sel = select <8 x i1> %cmp, <8 x i32> %bcx, <8 x i32> %bcy
  %bcs = bitcast <8 x i32> %sel to <8 x float>
  ret <8 x float> %bcs
}
=>
define <8 x float> @bitcast_vector_smin(<8 x float> %x, <8 x float> %y) {
%0:
  %bcx = bitcast <8 x float> %x to <8 x i32>
  %bcy = bitcast <8 x float> %y to <8 x i32>
  %cmp = icmp slt <8 x i32> %bcx, %bcy
  %sel = select <8 x i1> %cmp, <8 x i32> %bcx, <8 x i32> %bcy
  %bcs = bitcast <8 x i32> %sel to <8 x float>
  ret <8 x float> %bcs
}
Transformation doesn't verify!
ERROR: Timeout


----------------------------------------
define <8 x float> @bitcast_vector_umin(<8 x float> %x, <8 x float> %y) {
%0:
  %bcx = bitcast <8 x float> %x to <8 x i32>
  %bcy = bitcast <8 x float> %y to <8 x i32>
  %cmp = icmp slt <8 x i32> %bcx, %bcy
  %sel = select <8 x i1> %cmp, <8 x float> %x, <8 x float> %y
  ret <8 x float> %sel
}
=>
define <8 x float> @bitcast_vector_umin(<8 x float> %x, <8 x float> %y) {
%0:
  %bcx = bitcast <8 x float> %x to <8 x i32>
  %bcy = bitcast <8 x float> %y to <8 x i32>
  %cmp = icmp slt <8 x i32> %bcx, %bcy
  %sel = select <8 x i1> %cmp, <8 x float> %x, <8 x float> %y
  ret <8 x float> %sel
}
Transformation doesn't verify!
ERROR: Timeout


----------------------------------------
define i8 @look_through_cast1(i32 %x) {
%0:
  %cmp1 = icmp slt i32 %x, 511
  %x_trunc = trunc i32 %x to i8
  %res = select i1 %cmp1, i8 %x_trunc, i8 255
  ret i8 %res
}
=>
define i8 @look_through_cast1(i32 %x) {
%0:
  %1 = icmp slt i32 %x, 511
  %res1 = select i1 %1, i32 %x, i32 511
  %2 = trunc i32 %res1 to i8
  ret i8 %2
}
Transformation seems to be correct!


----------------------------------------
define i8 @look_through_cast2(i32 %x) {
%0:
  %cmp1 = icmp slt i32 %x, 510
  %x_trunc = trunc i32 %x to i8
  %res = select i1 %cmp1, i8 %x_trunc, i8 255
  ret i8 %res
}
=>
define i8 @look_through_cast2(i32 %x) {
%0:
  %cmp1 = icmp slt i32 %x, 510
  %x_trunc = trunc i32 %x to i8
  %res = select i1 %cmp1, i8 %x_trunc, i8 255
  ret i8 %res
}
Transformation seems to be correct!


----------------------------------------
define <2 x i8> @min_through_cast_vec1(<2 x i32> %x) {
%0:
  %cmp = icmp slt <2 x i32> %x, { 510, 511 }
  %x_trunc = trunc <2 x i32> %x to <2 x i8>
  %res = select <2 x i1> %cmp, <2 x i8> %x_trunc, <2 x i8> { 254, 255 }
  ret <2 x i8> %res
}
=>
define <2 x i8> @min_through_cast_vec1(<2 x i32> %x) {
%0:
  %1 = icmp slt <2 x i32> %x, { 510, 511 }
  %res1 = select <2 x i1> %1, <2 x i32> %x, <2 x i32> { 510, 511 }
  %2 = trunc <2 x i32> %res1 to <2 x i8>
  ret <2 x i8> %2
}
Transformation doesn't verify!
ERROR: Timeout


----------------------------------------
define <2 x i8> @min_through_cast_vec2(<2 x i32> %x) {
%0:
  %cmp = icmp slt <2 x i32> %x, { 511, 511 }
  %x_trunc = trunc <2 x i32> %x to <2 x i8>
  %res = select <2 x i1> %cmp, <2 x i8> %x_trunc, <2 x i8> { 255, 255 }
  ret <2 x i8> %res
}
=>
define <2 x i8> @min_through_cast_vec2(<2 x i32> %x) {
%0:
  %1 = icmp slt <2 x i32> %x, { 511, 511 }
  %res1 = select <2 x i1> %1, <2 x i32> %x, <2 x i32> { 511, 511 }
  %2 = trunc <2 x i32> %res1 to <2 x i8>
  ret <2 x i8> %2
}
Transformation doesn't verify!
ERROR: Timeout


----------------------------------------
define i32 @common_factor_smin(i32 %a, i32 %b, i32 %c) {
%0:
  %cmp_ab = icmp slt i32 %a, %b
  %min_ab = select i1 %cmp_ab, i32 %a, i32 %b
  %cmp_bc = icmp slt i32 %b, %c
  %min_bc = select i1 %cmp_bc, i32 %b, i32 %c
  %cmp_ab_bc = icmp slt i32 %min_ab, %min_bc
  %min_abc = select i1 %cmp_ab_bc, i32 %min_ab, i32 %min_bc
  ret i32 %min_abc
}
=>
define i32 @common_factor_smin(i32 %a, i32 %b, i32 %c) {
%0:
  %cmp_ab = icmp slt i32 %a, %b
  %min_ab = select i1 %cmp_ab, i32 %a, i32 %b
  %1 = icmp slt i32 %min_ab, %c
  %min_abc = select i1 %1, i32 %min_ab, i32 %c
  ret i32 %min_abc
}
Transformation seems to be correct!


----------------------------------------
define <2 x i32> @common_factor_smax(<2 x i32> %a, <2 x i32> %b, <2 x i32> %c) {
%0:
  %cmp_ab = icmp sgt <2 x i32> %a, %b
  %max_ab = select <2 x i1> %cmp_ab, <2 x i32> %a, <2 x i32> %b
  %cmp_cb = icmp sgt <2 x i32> %c, %b
  %max_cb = select <2 x i1> %cmp_cb, <2 x i32> %c, <2 x i32> %b
  %cmp_ab_cb = icmp sgt <2 x i32> %max_ab, %max_cb
  %max_abc = select <2 x i1> %cmp_ab_cb, <2 x i32> %max_ab, <2 x i32> %max_cb
  ret <2 x i32> %max_abc
}
=>
define <2 x i32> @common_factor_smax(<2 x i32> %a, <2 x i32> %b, <2 x i32> %c) {
%0:
  %cmp_ab = icmp sgt <2 x i32> %a, %b
  %max_ab = select <2 x i1> %cmp_ab, <2 x i32> %a, <2 x i32> %b
  %1 = icmp sgt <2 x i32> %max_ab, %c
  %max_abc = select <2 x i1> %1, <2 x i32> %max_ab, <2 x i32> %c
  ret <2 x i32> %max_abc
}
Transformation doesn't verify!
ERROR: Target's return value is more undefined

Example:
<2 x i32> %a = < #x80000000 (2147483648, -2147483648), poison >
<2 x i32> %b = < #x7fffffff (2147483647), poison >
<2 x i32> %c = < undef, poison >

Source:
<2 x i1> %cmp_ab = < #x0 (0), poison >
<2 x i32> %max_ab = < #x7fffffff (2147483647), poison >
<2 x i1> %cmp_cb = < #x0 (0), poison >
<2 x i32> %max_cb = < #x7fffffff (2147483647), poison >
<2 x i1> %cmp_ab_cb = < #x0 (0), poison >
<2 x i32> %max_abc = < #x7fffffff (2147483647), poison >

Target:
<2 x i1> %cmp_ab = < #x0 (0), poison >
<2 x i32> %max_ab = < #x7fffffff (2147483647), poison >
<2 x i1> %1 = < #x0 (0), poison >
<2 x i32> %max_abc = < #x00001000 (4096), poison >
Source value: < #x7fffffff (2147483647), poison >
Target value: < #x00001000 (4096), poison >


------------------- SMT STATS -------------------
Num queries: 197
Num invalid: 0
Num skips:   0
Num trivial: 142 (41.9%)
Num timeout: 10 (5.1%)
Num errors:  0 (0.0%)
Num SAT:     52 (26.4%)
Num UNSAT:   135 (68.5%)

stderr:

+ : 'RUN: at line 2'
+ /home/nlopes/alive2/build/opt-alive.sh -S -instcombine
+ /home/nlopes/llvm/build/bin/FileCheck --allow-unused-prefixes=false /home/nlopes/llvm/llvm/test/Transforms/InstCombine/minmax-fold.ll

Alive2: Transform doesn't verify; aborting!
FileCheck error: '<stdin>' is empty.
FileCheck command line:  /home/nlopes/llvm/build/bin/FileCheck --allow-unused-prefixes=false /home/nlopes/llvm/llvm/test/Transforms/InstCombine/minmax-fold.ll

 

<-- Back