Test Failure: Transforms/InstCombine/phi.ll

Test source: git

Log:

Source: <stdin>
-- 1. ModuleToFunctionPassAdaptor
ERROR: Unsupported instruction:   %y = load atomic i32, ptr %atomic_ptr acquire, align 4
-- 1. PassManager<Function> : Skipping NOP
-- 2. InstCombinePass

----------------------------------------
define i32 @test1(i32 %A, i1 %b) {
BB0:
  br i1 %b, label %BB1, label %BB2

BB2:
  ret i32 %A

BB1:
  %B = phi i32 [ %A, %BB0 ]
  ret i32 %B
}
Transformation seems to be correct! (syntactically equal)

-- 3. InstCombinePass

----------------------------------------
define i32 @test1(i32 %A, i1 %b) {
BB0:
  br i1 %b, label %BB1, label %BB2

BB2:
  ret i32 %A

BB1:
  %B = phi i32 [ %A, %BB0 ]
  ret i32 %B
}
=>
define i32 @test1(i32 %A, i1 %b) {
BB0:
  br i1 %b, label %BB1, label %BB2

BB2:
  ret i32 %A

BB1:
  ret i32 %A
}
Transformation seems to be correct!

-- 4. PassManager<Function> : Skipping NOP
-- 5. PassManager<Function> : Skipping NOP
-- 6. InstCombinePass

----------------------------------------
define i32 @test2(i32 %A, i1 %b) {
BB0:
  br i1 %b, label %BB1, label %BB2

BB1:
  br label %BB2

BB2:
  %B = phi i32 [ %A, %BB0 ], [ %A, %BB1 ]
  ret i32 %B
}
Transformation seems to be correct! (syntactically equal)

-- 7. InstCombinePass

----------------------------------------
define i32 @test2(i32 %A, i1 %b) {
BB0:
  br i1 %b, label %BB1, label %BB2

BB1:
  br label %BB2

BB2:
  %B = phi i32 [ %A, %BB0 ], [ %A, %BB1 ]
  ret i32 %B
}
=>
define i32 @test2(i32 %A, i1 %b) {
BB0:
  br i1 %b, label %BB1, label %BB2

BB1:
  br label %BB2

BB2:
  ret i32 %A
}
Transformation seems to be correct!

-- 8. PassManager<Function> : Skipping NOP
-- 9. PassManager<Function> : Skipping NOP
-- 10. InstCombinePass

----------------------------------------
define i32 @test3(i32 %A, i1 %b) {
BB0:
  br label %Loop

Loop:
  %B = phi i32 [ %A, %BB0 ], [ %B, %Loop ]
  br i1 %b, label %Loop, label %Exit

Exit:
  ret i32 %B
}
Transformation seems to be correct! (syntactically equal)

-- 11. InstCombinePass

----------------------------------------
define i32 @test3(i32 %A, i1 %b) {
BB0:
  br label %Loop

Loop:
  %B = phi i32 [ %A, %BB0 ], [ %B, %Loop ]
  br i1 %b, label %Loop, label %Exit

Exit:
  ret i32 %B
}
=>
define i32 @test3(i32 %A, i1 %b) {
BB0:
  br label %Loop

Loop:
  br i1 %b, label %Loop, label %Exit

Exit:
  ret i32 %A
}
Transformation seems to be correct!

-- 12. PassManager<Function> : Skipping NOP
-- 13. PassManager<Function> : Skipping NOP
-- 14. InstCombinePass

----------------------------------------
define i32 @test4(i1 %b) {
BB0:
  ret i32 7

Loop:
  %B = phi i32 [ %B, %L2 ], [ %B, %Loop ]
  br i1 %b, label %L2, label %Loop

L2:
  br label %Loop
}
Transformation seems to be correct! (syntactically equal)

-- 15. InstCombinePass

----------------------------------------
define i32 @test4(i1 %b) {
BB0:
  ret i32 7
}
=>
define i32 @test4(i1 %b) {
BB0:
  ret i32 7
}
Transformation seems to be correct!

-- 16. PassManager<Function> : Skipping NOP
-- 17. PassManager<Function> : Skipping NOP
-- 18. InstCombinePass

----------------------------------------
define i32 @test5_undef(i32 %A, i1 %cond) {
BB0:
  br label %Loop

Loop:
  %B = phi i32 [ %A, %BB0 ], [ undef, %Loop ]
  br i1 %cond, label %Loop, label %Exit

Exit:
  ret i32 %B
}
Transformation seems to be correct! (syntactically equal)

-- 19. InstCombinePass

----------------------------------------
define i32 @test5_undef(i32 %A, i1 %cond) {
BB0:
  br label %Loop

Loop:
  %B = phi i32 [ %A, %BB0 ], [ undef, %Loop ]
  br i1 %cond, label %Loop, label %Exit

Exit:
  ret i32 %B
}
=>
define i32 @test5_undef(i32 %A, i1 %cond) {
BB0:
  br label %Loop

Loop:
  br i1 %cond, label %Loop, label %Exit

Exit:
  ret i32 %A
}
Transformation seems to be correct!

-- 20. PassManager<Function> : Skipping NOP
-- 21. PassManager<Function> : Skipping NOP
-- 22. InstCombinePass

----------------------------------------
define i32 @test5_poison(i32 %A, i1 %cond) {
BB0:
  br label %Loop

Loop:
  %B = phi i32 [ %A, %BB0 ], [ poison, %Loop ]
  br i1 %cond, label %Loop, label %Exit

Exit:
  ret i32 %B
}
Transformation seems to be correct! (syntactically equal)

-- 23. InstCombinePass

----------------------------------------
define i32 @test5_poison(i32 %A, i1 %cond) {
BB0:
  br label %Loop

Loop:
  %B = phi i32 [ %A, %BB0 ], [ poison, %Loop ]
  br i1 %cond, label %Loop, label %Exit

Exit:
  ret i32 %B
}
=>
define i32 @test5_poison(i32 %A, i1 %cond) {
BB0:
  br label %Loop

Loop:
  br i1 %cond, label %Loop, label %Exit

Exit:
  ret i32 %A
}
Transformation seems to be correct!

-- 24. PassManager<Function> : Skipping NOP
-- 25. PassManager<Function> : Skipping NOP
-- 26. InstCombinePass

----------------------------------------
define i32 @test6(i16 %A, i1 %b) {
BB0:
  %X = zext i16 %A to i32
  br i1 %b, label %BB1, label %BB2

BB1:
  %Y = zext i16 %A to i32
  br label %BB2

BB2:
  %c = phi i32 [ %X, %BB0 ], [ %Y, %BB1 ]
  ret i32 %c
}
Transformation seems to be correct! (syntactically equal)

-- 27. InstCombinePass

----------------------------------------
define i32 @test6(i16 %A, i1 %b) {
BB0:
  %X = zext i16 %A to i32
  br i1 %b, label %BB1, label %BB2

BB1:
  %Y = zext i16 %A to i32
  br label %BB2

BB2:
  %c = phi i32 [ %X, %BB0 ], [ %Y, %BB1 ]
  ret i32 %c
}
=>
define i32 @test6(i16 %A, i1 %b) {
BB0:
  br i1 %b, label %BB1, label %BB2

BB1:
  br label %BB2

BB2:
  %c = zext i16 %A to i32
  ret i32 %c
}
Transformation seems to be correct!

-- 28. PassManager<Function> : Skipping NOP
-- 29. PassManager<Function> : Skipping NOP
-- 30. InstCombinePass

----------------------------------------
define i32 @test_dead_cycle(i32 %A, i1 %cond) {
BB0:
  br label %Loop

Loop:
  %B = phi i32 [ %A, %BB0 ], [ %C, %Loop ]
  %C = add i32 %B, 123
  br i1 %cond, label %Loop, label %Exit

Exit:
  ret i32 0
}
Transformation seems to be correct! (syntactically equal)

-- 31. InstCombinePass

----------------------------------------
define i32 @test_dead_cycle(i32 %A, i1 %cond) {
BB0:
  br label %Loop

Loop:
  %B = phi i32 [ %A, %BB0 ], [ %C, %Loop ]
  %C = add i32 %B, 123
  br i1 %cond, label %Loop, label %Exit

Exit:
  ret i32 0
}
=>
define i32 @test_dead_cycle(i32 %A, i1 %cond) {
BB0:
  br label %Loop

Loop:
  br i1 %cond, label %Loop, label %Exit

Exit:
  ret i32 0
}
Transformation seems to be correct!

-- 32. PassManager<Function> : Skipping NOP
-- 33. PassManager<Function> : Skipping NOP
-- 34. InstCombinePass

----------------------------------------
define i32 @test_dead_UnaryOp_cycle(double %A, i1 %cond) {
BB0:
  br label %Loop

Loop:
  %B = phi double [ %A, %BB0 ], [ %C, %Loop ]
  %C = fneg double %B
  br i1 %cond, label %Loop, label %Exit

Exit:
  ret i32 0
}
Transformation seems to be correct! (syntactically equal)

-- 35. InstCombinePass

----------------------------------------
define i32 @test_dead_UnaryOp_cycle(double %A, i1 %cond) {
BB0:
  br label %Loop

Loop:
  %B = phi double [ %A, %BB0 ], [ %C, %Loop ]
  %C = fneg double %B
  br i1 %cond, label %Loop, label %Exit

Exit:
  ret i32 0
}
=>
define i32 @test_dead_UnaryOp_cycle(double %A, i1 %cond) {
BB0:
  br label %Loop

Loop:
  br i1 %cond, label %Loop, label %Exit

Exit:
  ret i32 0
}
Transformation seems to be correct!

-- 36. PassManager<Function> : Skipping NOP
-- 37. PassManager<Function> : Skipping NOP
-- 38. InstCombinePass

----------------------------------------
define i32 @test_dead_cycle_two_insts(i32 %A, i1 %cond) {
BB0:
  br label %Loop

Loop:
  %B = phi i32 [ %A, %BB0 ], [ %D, %Loop ]
  %C = add i32 %B, 123
  %D = lshr i32 %C, 1
  br i1 %cond, label %Loop, label %Exit

Exit:
  ret i32 0
}
Transformation seems to be correct! (syntactically equal)

-- 39. InstCombinePass

----------------------------------------
define i32 @test_dead_cycle_two_insts(i32 %A, i1 %cond) {
BB0:
  br label %Loop

Loop:
  %B = phi i32 [ %A, %BB0 ], [ %D, %Loop ]
  %C = add i32 %B, 123
  %D = lshr i32 %C, 1
  br i1 %cond, label %Loop, label %Exit

Exit:
  ret i32 0
}
Transformation seems to be correct! (syntactically equal)

-- 40. PassManager<Function> : Skipping NOP
-- 41. PassManager<Function> : Skipping NOP
-- 42. InstCombinePass

----------------------------------------
define i32 @test_dead_cycle_intrin(i32 %A, i1 %cond) {
BB0:
  br label %Loop

Loop:
  %B = phi i32 [ %A, %BB0 ], [ %C, %Loop ]
  %C = uadd_sat i32 %B, 123
  br i1 %cond, label %Loop, label %Exit

Exit:
  ret i32 0
}
Transformation seems to be correct! (syntactically equal)

-- 43. InstCombinePass

----------------------------------------
define i32 @test_dead_cycle_intrin(i32 %A, i1 %cond) {
BB0:
  br label %Loop

Loop:
  %B = phi i32 [ %A, %BB0 ], [ %C, %Loop ]
  %C = uadd_sat i32 %B, 123
  br i1 %cond, label %Loop, label %Exit

Exit:
  ret i32 0
}
Transformation seems to be correct! (syntactically equal)

-- 44. PassManager<Function> : Skipping NOP
-- 45. PassManager<Function> : Skipping NOP
-- 46. InstCombinePass

----------------------------------------
define ptr @test8(ptr %A, i1 %b) {
BB0:
  %X = gep inbounds ptr %A, 8 x i32 0, 1 x i64 4
  br i1 %b, label %BB1, label %BB2

BB1:
  %Y = gep ptr %A, 8 x i32 0, 1 x i64 4
  br label %BB2

BB2:
  %c = phi ptr [ %X, %BB0 ], [ %Y, %BB1 ]
  ret ptr %c
}
Transformation seems to be correct! (syntactically equal)

-- 47. InstCombinePass

----------------------------------------
define ptr @test8(ptr %A, i1 %b) {
BB0:
  %X = gep inbounds ptr %A, 8 x i32 0, 1 x i64 4
  br i1 %b, label %BB1, label %BB2

BB1:
  %Y = gep ptr %A, 8 x i32 0, 1 x i64 4
  br label %BB2

BB2:
  %c = phi ptr [ %X, %BB0 ], [ %Y, %BB1 ]
  ret ptr %c
}
=>
define ptr @test8(ptr %A, i1 %b) {
BB0:
  br i1 %b, label %BB1, label %BB2

BB1:
  br label %BB2

BB2:
  %c = gep ptr %A, 1 x i64 4
  ret ptr %c
}
Transformation seems to be correct!

-- 48. PassManager<Function> : Skipping NOP
-- 49. PassManager<Function> : Skipping NOP
-- 50. InstCombinePass

----------------------------------------
define i32 @test9(ptr %A, ptr %B) {
entry:
  %c = icmp eq ptr %A, null
  br i1 %c, label %bb1, label %bb

bb:
  %C = load i32, ptr %B, align 1
  br label %bb2

bb1:
  %D = load i32, ptr %A, align 1
  br label %bb2

bb2:
  %E = phi i32 [ %C, %bb ], [ %D, %bb1 ]
  ret i32 %E
}
Transformation seems to be correct! (syntactically equal)

-- 51. InstCombinePass

----------------------------------------
define i32 @test9(ptr %A, ptr %B) {
entry:
  %c = icmp eq ptr %A, null
  br i1 %c, label %bb1, label %bb

bb:
  %C = load i32, ptr %B, align 1
  br label %bb2

bb1:
  %D = load i32, ptr %A, align 1
  br label %bb2

bb2:
  %E = phi i32 [ %C, %bb ], [ %D, %bb1 ]
  ret i32 %E
}
=>
define i32 @test9(ptr %A, ptr %B) {
entry:
  %c = icmp eq ptr %A, null
  br i1 %c, label %bb1, label %bb

bb:
  br label %bb2

bb1:
  br label %bb2

bb2:
  %E.in = phi ptr [ %B, %bb ], [ %A, %bb1 ]
  %E = load i32, ptr %E.in, align 1
  ret i32 %E
}
Transformation seems to be correct!

-- 52. PassManager<Function> : Skipping NOP
-- 53. PassManager<Function> : Skipping NOP
-- 54. InstCombinePass

----------------------------------------
define i32 @test10(ptr %A, ptr %B) {
entry:
  %c = icmp eq ptr %A, null
  br i1 %c, label %bb1, label %bb

bb:
  %C = load i32, ptr %B, align 16
  br label %bb2

bb1:
  %D = load i32, ptr %A, align 32
  br label %bb2

bb2:
  %E = phi i32 [ %C, %bb ], [ %D, %bb1 ]
  ret i32 %E
}
Transformation seems to be correct! (syntactically equal)

-- 55. InstCombinePass

----------------------------------------
define i32 @test10(ptr %A, ptr %B) {
entry:
  %c = icmp eq ptr %A, null
  br i1 %c, label %bb1, label %bb

bb:
  %C = load i32, ptr %B, align 16
  br label %bb2

bb1:
  %D = load i32, ptr %A, align 32
  br label %bb2

bb2:
  %E = phi i32 [ %C, %bb ], [ %D, %bb1 ]
  ret i32 %E
}
=>
define i32 @test10(ptr %A, ptr %B) {
entry:
  %c = icmp eq ptr %A, null
  br i1 %c, label %bb1, label %bb

bb:
  br label %bb2

bb1:
  br label %bb2

bb2:
  %E.in = phi ptr [ %B, %bb ], [ %A, %bb1 ]
  %E = load i32, ptr %E.in, align 16
  ret i32 %E
}
Transformation seems to be correct!

-- 56. PassManager<Function> : Skipping NOP
-- 57. PassManager<Function> : Skipping NOP
-- 58. InstCombinePass

----------------------------------------
declare i1 @test11a()

define i1 @test11() {
entry:
  %a = alloca i64 4, align 4
  %i = ptrtoint ptr %a to i64
  %b = call i1 @test11a()
  br i1 %b, label %one, label %two

one:
  %x = phi i64 [ %i, %entry ], [ %y, %two ]
  %c = call i1 @test11a()
  br i1 %c, label %two, label %end

two:
  %y = phi i64 [ %i, %entry ], [ %x, %one ]
  %d = call i1 @test11a()
  br i1 %d, label %one, label %end

end:
  %f = phi i64 [ %x, %one ], [ %y, %two ]
  %g = int2ptr i64 %f to ptr
  store i32 10, ptr %g, align 4
  %z = call i1 @test11a()
  ret i1 %z
}
Transformation seems to be correct! (syntactically equal)

-- 59. InstCombinePass

----------------------------------------
declare i1 @test11a()

define i1 @test11() {
entry:
  %a = alloca i64 4, align 4
  %i = ptrtoint ptr %a to i64
  %b = call i1 @test11a()
  br i1 %b, label %one, label %two

one:
  %x = phi i64 [ %i, %entry ], [ %y, %two ]
  %c = call i1 @test11a()
  br i1 %c, label %two, label %end

two:
  %y = phi i64 [ %i, %entry ], [ %x, %one ]
  %d = call i1 @test11a()
  br i1 %d, label %one, label %end

end:
  %f = phi i64 [ %x, %one ], [ %y, %two ]
  %g = int2ptr i64 %f to ptr
  store i32 10, ptr %g, align 4
  %z = call i1 @test11a()
  ret i1 %z
}
=>
declare i1 @test11a()

define i1 @test11() {
entry:
  %b = call i1 @test11a()
  br i1 %b, label %one, label %two

one:
  %c = call i1 @test11a()
  br i1 %c, label %two, label %end

two:
  %d = call i1 @test11a()
  br i1 %d, label %one, label %end

end:
  %z = call i1 @test11a()
  ret i1 %z
}
Transformation doesn't verify! (not unsound)
ERROR: Timeout
-- 60. PassManager<Function> : Skipping NOP
-- 61. PassManager<Function> : Skipping NOP
-- 62. InstCombinePass

----------------------------------------
define i64 @test12(i1 %cond, ptr %Ptr, i64 %Val) {
entry:
  %t41 = ptrtoint ptr %Ptr to i64
  %t42 = zext i64 %t41 to i128
  br i1 %cond, label %end, label %two

two:
  %t36 = zext i64 %Val to i128
  %t37 = shl i128 %t36, 64
  %ins39 = or i128 %t42, %t37
  br label %end

end:
  %t869.0 = phi i128 [ %t42, %entry ], [ %ins39, %two ]
  %t32 = trunc i128 %t869.0 to i64
  %t29 = lshr i128 %t869.0, 64
  %t30 = trunc i128 %t29 to i64
  %t2 = add i64 %t32, %t30
  ret i64 %t2
}
Transformation seems to be correct! (syntactically equal)

-- 63. InstCombinePass

----------------------------------------
define i64 @test12(i1 %cond, ptr %Ptr, i64 %Val) {
entry:
  %t41 = ptrtoint ptr %Ptr to i64
  %t42 = zext i64 %t41 to i128
  br i1 %cond, label %end, label %two

two:
  %t36 = zext i64 %Val to i128
  %t37 = shl i128 %t36, 64
  %ins39 = or i128 %t42, %t37
  br label %end

end:
  %t869.0 = phi i128 [ %t42, %entry ], [ %ins39, %two ]
  %t32 = trunc i128 %t869.0 to i64
  %t29 = lshr i128 %t869.0, 64
  %t30 = trunc i128 %t29 to i64
  %t2 = add i64 %t32, %t30
  ret i64 %t2
}
=>
define i64 @test12(i1 %cond, ptr %Ptr, i64 %Val) {
entry:
  br i1 %cond, label %end, label %two

two:
  br label %end

end:
  %t869.0.off64 = phi i64 [ 0, %entry ], [ %Val, %two ]
  %t41 = ptrtoint ptr %Ptr to i64
  %t2 = add i64 %t869.0.off64, %t41
  ret i64 %t2
}
Transformation doesn't verify! (not unsound)
ERROR: Timeout
-- 64. PassManager<Function> : Skipping NOP
-- 65. PassManager<Function> : Skipping NOP
-- 66. InstCombinePass

----------------------------------------
declare void @test13f(double, i32)

define void @test13(i1 %cond, i32 %V1, double %Vald) {
entry:
  %t42 = zext i32 %V1 to i128
  br i1 %cond, label %end, label %two

two:
  %Val = bitcast double %Vald to i64
  %t36 = zext i64 %Val to i128
  %t37 = shl i128 %t36, 64
  %ins39 = or i128 %t42, %t37
  br label %end

end:
  %t869.0 = phi i128 [ %t42, %entry ], [ %ins39, %two ]
  %t32 = trunc i128 %t869.0 to i32
  %t29 = lshr i128 %t869.0, 64
  %t30 = trunc i128 %t29 to i64
  %t31 = bitcast i64 %t30 to double
  call void @test13f(double %t31, i32 %t32)
  ret void
}
Transformation seems to be correct! (syntactically equal)

-- 67. InstCombinePass

----------------------------------------
declare void @test13f(double, i32)

define void @test13(i1 %cond, i32 %V1, double %Vald) {
entry:
  %t42 = zext i32 %V1 to i128
  br i1 %cond, label %end, label %two

two:
  %Val = bitcast double %Vald to i64
  %t36 = zext i64 %Val to i128
  %t37 = shl i128 %t36, 64
  %ins39 = or i128 %t42, %t37
  br label %end

end:
  %t869.0 = phi i128 [ %t42, %entry ], [ %ins39, %two ]
  %t32 = trunc i128 %t869.0 to i32
  %t29 = lshr i128 %t869.0, 64
  %t30 = trunc i128 %t29 to i64
  %t31 = bitcast i64 %t30 to double
  call void @test13f(double %t31, i32 %t32)
  ret void
}
=>
declare void @test13f(double, i32)

define void @test13(i1 %cond, i32 %V1, double %Vald) {
entry:
  br i1 %cond, label %end, label %two

two:
  br label %end

end:
  %t31 = phi double [ 0.000000, %entry ], [ %Vald, %two ]
  call void @test13f(double %t31, i32 %V1)
  ret void
}
Transformation seems to be correct!

-- 68. PassManager<Function> : Skipping NOP
-- 69. PassManager<Function> : Skipping NOP
-- 70. InstCombinePass

----------------------------------------
define i640 @test14a(i320 %A, i320 %B, i1 %b1) {
BB0:
  %a = zext i320 %A to i640
  %b = zext i320 %B to i640
  br label %Loop

Loop:
  %C = phi i640 [ %a, %BB0 ], [ %b, %Loop ]
  br i1 %b1, label %Loop, label %Exit

Exit:
  ret i640 %C
}
Transformation seems to be correct! (syntactically equal)

-- 71. InstCombinePass

----------------------------------------
define i640 @test14a(i320 %A, i320 %B, i1 %b1) {
BB0:
  %a = zext i320 %A to i640
  %b = zext i320 %B to i640
  br label %Loop

Loop:
  %C = phi i640 [ %a, %BB0 ], [ %b, %Loop ]
  br i1 %b1, label %Loop, label %Exit

Exit:
  ret i640 %C
}
=>
define i640 @test14a(i320 %A, i320 %B, i1 %b1) {
BB0:
  br label %Loop

Loop:
  %C.in = phi i320 [ %A, %BB0 ], [ %B, %Loop ]
  br i1 %b1, label %Loop, label %Exit

Exit:
  %C = zext i320 %C.in to i640
  ret i640 %C
}
Transformation seems to be correct!

-- 72. PassManager<Function> : Skipping NOP
-- 73. PassManager<Function> : Skipping NOP
-- 74. InstCombinePass

----------------------------------------
define i160 @test14b(i320 %pA, i320 %pB, i1 %b1) {
BB0:
  %a = trunc i320 %pA to i160
  %b = trunc i320 %pB to i160
  br label %Loop

Loop:
  %C = phi i160 [ %a, %BB0 ], [ %b, %Loop ]
  br i1 %b1, label %Loop, label %Exit

Exit:
  ret i160 %C
}
Transformation seems to be correct! (syntactically equal)

-- 75. InstCombinePass

----------------------------------------
define i160 @test14b(i320 %pA, i320 %pB, i1 %b1) {
BB0:
  %a = trunc i320 %pA to i160
  %b = trunc i320 %pB to i160
  br label %Loop

Loop:
  %C = phi i160 [ %a, %BB0 ], [ %b, %Loop ]
  br i1 %b1, label %Loop, label %Exit

Exit:
  ret i160 %C
}
Transformation seems to be correct! (syntactically equal)

-- 76. PassManager<Function> : Skipping NOP
-- 77. PassManager<Function> : Skipping NOP
-- 78. InstCombinePass

----------------------------------------
declare i64 @test15a(i64)

define i64 @test15b(i64 %A, i1 %b) {
entry:
  %i0 = zext i64 %A to i128
  %i1 = shl i128 %i0, 64
  %i = or i128 %i1, %i0
  br i1 %b, label %one, label %two

one:
  %x = phi i128 [ %i, %entry ], [ %y, %two ]
  %x1 = lshr i128 %x, 64
  %x2 = trunc i128 %x1 to i64
  %c = call i64 @test15a(i64 %x2)
  %c1 = zext i64 %c to i128
  br label %two

two:
  %y = phi i128 [ %i, %entry ], [ %c1, %one ]
  %y1 = lshr i128 %y, 64
  %y2 = trunc i128 %y1 to i64
  %d = call i64 @test15a(i64 %y2)
  %d1 = trunc i64 %d to i1
  br i1 %d1, label %one, label %end

end:
  %g = trunc i128 %y to i64
  ret i64 %g
}
Transformation seems to be correct! (syntactically equal)

-- 79. InstCombinePass

----------------------------------------
declare i64 @test15a(i64)

define i64 @test15b(i64 %A, i1 %b) {
entry:
  %i0 = zext i64 %A to i128
  %i1 = shl i128 %i0, 64
  %i = or i128 %i1, %i0
  br i1 %b, label %one, label %two

one:
  %x = phi i128 [ %i, %entry ], [ %y, %two ]
  %x1 = lshr i128 %x, 64
  %x2 = trunc i128 %x1 to i64
  %c = call i64 @test15a(i64 %x2)
  %c1 = zext i64 %c to i128
  br label %two

two:
  %y = phi i128 [ %i, %entry ], [ %c1, %one ]
  %y1 = lshr i128 %y, 64
  %y2 = trunc i128 %y1 to i64
  %d = call i64 @test15a(i64 %y2)
  %d1 = trunc i64 %d to i1
  br i1 %d1, label %one, label %end

end:
  %g = trunc i128 %y to i64
  ret i64 %g
}
=>
declare i64 @test15a(i64)

define i64 @test15b(i64 %A, i1 %b) {
entry:
  br i1 %b, label %one, label %two

one:
  %x.off64 = phi i64 [ %A, %entry ], [ %y.off64, %two ]
  %c = call i64 @test15a(i64 %x.off64)
  br label %two

two:
  %y.off0 = phi i64 [ %A, %entry ], [ %c, %one ]
  %y.off64 = phi i64 [ %A, %entry ], [ 0, %one ]
  %d = call i64 @test15a(i64 %y.off64)
  %d1 = trunc i64 %d to i1
  br i1 %d1, label %one, label %end

end:
  ret i64 %y.off0
}
Transformation seems to be correct!

-- 80. PassManager<Function> : Skipping NOP
-- 81. PassManager<Function> : Skipping NOP
-- 82. InstCombinePass
-- 83. InstCombinePass
-- 84. PassManager<Function> : Skipping NOP
-- 85. PassManager<Function> : Skipping NOP
-- 86. InstCombinePass

----------------------------------------
declare i32 @ext()

define i32 @test17(i1 %a) {
entry:
  br i1 %a, label %bb1, label %bb2

bb1:
  %#0 = call i32 @ext()
  br label %bb2

bb2:
  %cond = phi i1 [ 1, %bb1 ], [ 0, %entry ]
  %val = phi i32 [ %#0, %bb1 ], [ 0, %entry ]
  %res = select i1 %cond, i32 %val, i32 0
  ret i32 %res
}
Transformation seems to be correct! (syntactically equal)

-- 87. InstCombinePass

----------------------------------------
declare i32 @ext()

define i32 @test17(i1 %a) {
entry:
  br i1 %a, label %bb1, label %bb2

bb1:
  %#0 = call i32 @ext()
  br label %bb2

bb2:
  %cond = phi i1 [ 1, %bb1 ], [ 0, %entry ]
  %val = phi i32 [ %#0, %bb1 ], [ 0, %entry ]
  %res = select i1 %cond, i32 %val, i32 0
  ret i32 %res
}
=>
declare i32 @ext()

define i32 @test17(i1 %a) {
entry:
  br i1 %a, label %bb1, label %bb2

bb1:
  %#0 = call i32 @ext()
  br label %bb2

bb2:
  %res = phi i32 [ %#0, %bb1 ], [ 0, %entry ]
  ret i32 %res
}
Transformation seems to be correct!

-- 88. PassManager<Function> : Skipping NOP
-- 89. PassManager<Function> : Skipping NOP
ERROR: Unsupported instruction:   %y = load atomic i32, ptr %atomic_ptr acquire, align 4
-- 90. InstCombinePass
ERROR: Unsupported instruction:   %y = load atomic i32, ptr %atomic_ptr acquire, align 4
-- 91. InstCombinePass
ERROR: Unsupported instruction:   %y = load atomic i32, ptr %atomic_ptr acquire, align 4
-- 92. PassManager<Function> : Skipping NOP
ERROR: Unsupported instruction:   %y = load atomic i32, ptr %atomic_ptr acquire, align 4
-- 93. PassManager<Function> : Skipping NOP
-- 94. InstCombinePass

----------------------------------------
define i1 @test18(i1 %cond) {
#0:
  %zero = alloca i64 4, align 4
  %one = alloca i64 4, align 4
  br i1 %cond, label %true, label %false

false:
  br label %ret

true:
  br label %ret

ret:
  %ptr = phi ptr [ %zero, %true ], [ %one, %false ]
  %isnull = icmp eq ptr %ptr, null
  ret i1 %isnull
}
Transformation seems to be correct! (syntactically equal)

-- 95. InstCombinePass

----------------------------------------
define i1 @test18(i1 %cond) {
#0:
  %zero = alloca i64 4, align 4
  %one = alloca i64 4, align 4
  br i1 %cond, label %true, label %false

false:
  br label %ret

true:
  br label %ret

ret:
  %ptr = phi ptr [ %zero, %true ], [ %one, %false ]
  %isnull = icmp eq ptr %ptr, null
  ret i1 %isnull
}
=>
define i1 @test18(i1 %cond) {
#0:
  br i1 %cond, label %true, label %false

false:
  br label %ret

true:
  br label %ret

ret:
  ret i1 0
}
Transformation seems to be correct!

-- 96. PassManager<Function> : Skipping NOP
-- 97. PassManager<Function> : Skipping NOP
-- 98. InstCombinePass

----------------------------------------
define i1 @test19(i1 %cond, double %x) {
#0:
  br i1 %cond, label %true, label %false

false:
  br label %ret

true:
  br label %ret

ret:
  %p = phi double [ %x, %true ], [ inf, %false ]
  %cmp = fcmp ule double %x, %p
  ret i1 %cmp
}
Transformation seems to be correct! (syntactically equal)

-- 99. InstCombinePass

----------------------------------------
define i1 @test19(i1 %cond, double %x) {
#0:
  br i1 %cond, label %true, label %false

false:
  br label %ret

true:
  br label %ret

ret:
  %p = phi double [ %x, %true ], [ inf, %false ]
  %cmp = fcmp ule double %x, %p
  ret i1 %cmp
}
=>
define i1 @test19(i1 %cond, double %x) {
#0:
  br i1 %cond, label %true, label %false

false:
  br label %ret

true:
  br label %ret

ret:
  ret i1 1
}
Transformation seems to be correct!

-- 100. PassManager<Function> : Skipping NOP
-- 101. PassManager<Function> : Skipping NOP
-- 102. InstCombinePass

----------------------------------------
define i1 @test20(i1 %cond) {
#0:
  %a = alloca i64 4, align 4
  %b = alloca i64 4, align 4
  %c = alloca i64 4, align 4
  br i1 %cond, label %true, label %false

false:
  br label %ret

true:
  br label %ret

ret:
  %p = phi ptr [ %a, %true ], [ %b, %false ]
  %r = icmp eq ptr %p, %c
  ret i1 %r
}
Transformation seems to be correct! (syntactically equal)

-- 103. InstCombinePass

----------------------------------------
define i1 @test20(i1 %cond) {
#0:
  %a = alloca i64 4, align 4
  %b = alloca i64 4, align 4
  %c = alloca i64 4, align 4
  br i1 %cond, label %true, label %false

false:
  br label %ret

true:
  br label %ret

ret:
  %p = phi ptr [ %a, %true ], [ %b, %false ]
  %r = icmp eq ptr %p, %c
  ret i1 %r
}
=>
define i1 @test20(i1 %cond) {
#0:
  br i1 %cond, label %true, label %false

false:
  br label %ret

true:
  br label %ret

ret:
  ret i1 0
}
Transformation seems to be correct!

-- 104. PassManager<Function> : Skipping NOP
-- 105. PassManager<Function> : Skipping NOP
-- 106. InstCombinePass

----------------------------------------
define i1 @test21(i1 %c1, i1 %c2) {
#0:
  %a = alloca i64 4, align 4
  %b = alloca i64 4, align 4
  %c = alloca i64 4, align 4
  br i1 %c1, label %true, label %false

false:
  br label %loop

true:
  br label %loop

loop:
  %p = phi ptr [ %a, %true ], [ %b, %false ], [ %p, %loop ]
  %r = icmp eq ptr %p, %c
  br i1 %c2, label %ret, label %loop

ret:
  ret i1 %r
}
Transformation seems to be correct! (syntactically equal)

-- 107. InstCombinePass

----------------------------------------
define i1 @test21(i1 %c1, i1 %c2) {
#0:
  %a = alloca i64 4, align 4
  %b = alloca i64 4, align 4
  %c = alloca i64 4, align 4
  br i1 %c1, label %true, label %false

false:
  br label %loop

true:
  br label %loop

loop:
  %p = phi ptr [ %a, %true ], [ %b, %false ], [ %p, %loop ]
  %r = icmp eq ptr %p, %c
  br i1 %c2, label %ret, label %loop

ret:
  ret i1 %r
}
=>
define i1 @test21(i1 %c1, i1 %c2) {
#0:
  br i1 %c1, label %true, label %false

false:
  br label %loop

true:
  br label %loop

loop:
  br i1 %c2, label %ret, label %loop

ret:
  ret i1 0
}
Transformation seems to be correct!

-- 108. PassManager<Function> : Skipping NOP
-- 109. PassManager<Function> : Skipping NOP
-- 110. InstCombinePass

----------------------------------------
define void @test22() {
entry:
  br label %loop

loop:
  %phi = phi i32 [ 0, %entry ], [ %y, %loop ]
  %y = add i32 %phi, 1
  %o = or i32 %y, %phi
  %e = icmp eq i32 %o, %y
  br i1 %e, label %loop, label %ret

ret:
  ret void
}
Transformation seems to be correct! (syntactically equal)

-- 111. InstCombinePass

----------------------------------------
define void @test22() {
entry:
  br label %loop

loop:
  %phi = phi i32 [ 0, %entry ], [ %y, %loop ]
  %y = add i32 %phi, 1
  %o = or i32 %y, %phi
  %e = icmp eq i32 %o, %y
  br i1 %e, label %loop, label %ret

ret:
  ret void
}
Transformation seems to be correct! (syntactically equal)

-- 112. PassManager<Function> : Skipping NOP
-- 113. PassManager<Function> : Skipping NOP
-- 114. InstCombinePass

----------------------------------------
define i32 @test23(i32 %A, i1 %pb, ptr %P) {
BB0:
  br label %Loop

Loop:
  %B = phi i32 [ %A, %BB0 ], [ 42, %Loop ]
  %D = add i32 %B, 19
  store i32 %D, ptr %P, align 4
  br i1 %pb, label %Loop, label %Exit

Exit:
  %E = add i32 %B, 19
  ret i32 %E
}
Transformation seems to be correct! (syntactically equal)

-- 115. InstCombinePass

----------------------------------------
define i32 @test23(i32 %A, i1 %pb, ptr %P) {
BB0:
  br label %Loop

Loop:
  %B = phi i32 [ %A, %BB0 ], [ 42, %Loop ]
  %D = add i32 %B, 19
  store i32 %D, ptr %P, align 4
  br i1 %pb, label %Loop, label %Exit

Exit:
  %E = add i32 %B, 19
  ret i32 %E
}
=>
define i32 @test23(i32 %A, i1 %pb, ptr %P) {
BB0:
  %#0 = add i32 %A, 19
  br label %Loop

Loop:
  %B = phi i32 [ %#0, %BB0 ], [ 61, %Loop ]
  store i32 %B, ptr %P, align 4
  br i1 %pb, label %Loop, label %Exit

Exit:
  ret i32 %B
}
Transformation doesn't verify! (not unsound)
ERROR: Timeout
-- 116. PassManager<Function> : Skipping NOP
-- 117. PassManager<Function> : Skipping NOP
-- 118. InstCombinePass

----------------------------------------
define i32 @test24(i32 %A, i1 %cond) {
BB0:
  %X = add nsw nuw i32 %A, 1
  br i1 %cond, label %BB1, label %BB2

BB1:
  %Y = add nuw i32 %A, 1
  br label %BB2

BB2:
  %C = phi i32 [ %X, %BB0 ], [ %Y, %BB1 ]
  ret i32 %C
}
Transformation seems to be correct! (syntactically equal)

-- 119. InstCombinePass

----------------------------------------
define i32 @test24(i32 %A, i1 %cond) {
BB0:
  %X = add nsw nuw i32 %A, 1
  br i1 %cond, label %BB1, label %BB2

BB1:
  %Y = add nuw i32 %A, 1
  br label %BB2

BB2:
  %C = phi i32 [ %X, %BB0 ], [ %Y, %BB1 ]
  ret i32 %C
}
=>
define i32 @test24(i32 %A, i1 %cond) {
BB0:
  br i1 %cond, label %BB1, label %BB2

BB1:
  br label %BB2

BB2:
  %C = add nuw i32 %A, 1
  ret i32 %C
}
Transformation seems to be correct!

-- 120. PassManager<Function> : Skipping NOP
-- 121. PassManager<Function> : Skipping NOP
-- 122. InstCombinePass

----------------------------------------
declare i1 @test25a()

define i1 @test25() {
entry:
  %a = alloca i64 4, align 4
  %i = ptrtoint ptr %a to i64
  %b = call i1 @test25a()
  br i1 %b, label %one, label %two

one:
  %x = phi i64 [ %y, %two ], [ %i, %entry ]
  %c = call i1 @test25a()
  br i1 %c, label %two, label %end

two:
  %y = phi i64 [ %x, %one ], [ %i, %entry ]
  %d = call i1 @test25a()
  br i1 %d, label %one, label %end

end:
  %f = phi i64 [ %x, %one ], [ %y, %two ]
  %g = int2ptr i64 %f to ptr
  store i32 10, ptr %g, align 4
  %z = call i1 @test25a()
  ret i1 %z
}
Transformation seems to be correct! (syntactically equal)

-- 123. InstCombinePass

----------------------------------------
declare i1 @test25a()

define i1 @test25() {
entry:
  %a = alloca i64 4, align 4
  %i = ptrtoint ptr %a to i64
  %b = call i1 @test25a()
  br i1 %b, label %one, label %two

one:
  %x = phi i64 [ %y, %two ], [ %i, %entry ]
  %c = call i1 @test25a()
  br i1 %c, label %two, label %end

two:
  %y = phi i64 [ %x, %one ], [ %i, %entry ]
  %d = call i1 @test25a()
  br i1 %d, label %one, label %end

end:
  %f = phi i64 [ %x, %one ], [ %y, %two ]
  %g = int2ptr i64 %f to ptr
  store i32 10, ptr %g, align 4
  %z = call i1 @test25a()
  ret i1 %z
}
=>
declare i1 @test25a()

define i1 @test25() {
entry:
  %b = call i1 @test25a()
  br i1 %b, label %one, label %two

one:
  %c = call i1 @test25a()
  br i1 %c, label %two, label %end

two:
  %d = call i1 @test25a()
  br i1 %d, label %one, label %end

end:
  %z = call i1 @test25a()
  ret i1 %z
}
Transformation doesn't verify! (not unsound)
ERROR: Timeout
-- 124. PassManager<Function> : Skipping NOP
-- 125. PassManager<Function> : Skipping NOP
-- 126. InstCombinePass

----------------------------------------
declare i1 @test25a()

define i1 @test25b(i1 %ci, i64 %ai, i64 %bi) {
entry:
  br i1 %ci, label %then, label %else

then:
  br label %else

else:
  %i = phi i64 [ %ai, %entry ], [ %bi, %then ]
  %b = call i1 @test25a()
  br i1 %b, label %one, label %two

two:
  %y = phi i64 [ %x, %one ], [ %i, %else ]
  %d = call i1 @test25a()
  br i1 %d, label %one, label %end

one:
  %x = phi i64 [ %y, %two ], [ %i, %else ]
  %c = call i1 @test25a()
  br i1 %c, label %two, label %end

end:
  %f = phi i64 [ %x, %one ], [ %y, %two ]
  %g = int2ptr i64 %f to ptr
  store i32 10, ptr %g, align 4
  %z = call i1 @test25a()
  ret i1 %z
}
Transformation seems to be correct! (syntactically equal)

-- 127. InstCombinePass

----------------------------------------
declare i1 @test25a()

define i1 @test25b(i1 %ci, i64 %ai, i64 %bi) {
entry:
  br i1 %ci, label %then, label %else

then:
  br label %else

else:
  %i = phi i64 [ %ai, %entry ], [ %bi, %then ]
  %b = call i1 @test25a()
  br i1 %b, label %one, label %two

two:
  %y = phi i64 [ %x, %one ], [ %i, %else ]
  %d = call i1 @test25a()
  br i1 %d, label %one, label %end

one:
  %x = phi i64 [ %y, %two ], [ %i, %else ]
  %c = call i1 @test25a()
  br i1 %c, label %two, label %end

end:
  %f = phi i64 [ %x, %one ], [ %y, %two ]
  %g = int2ptr i64 %f to ptr
  store i32 10, ptr %g, align 4
  %z = call i1 @test25a()
  ret i1 %z
}
=>
declare i1 @test25a()

define i1 @test25b(i1 %ci, i64 %ai, i64 %bi) {
entry:
  br i1 %ci, label %then, label %else

then:
  br label %else

else:
  %i = phi i64 [ %ai, %entry ], [ %bi, %then ]
  %b = call i1 @test25a()
  br i1 %b, label %one, label %two

two:
  %d = call i1 @test25a()
  br i1 %d, label %one, label %end

one:
  %c = call i1 @test25a()
  br i1 %c, label %two, label %end

end:
  %g = int2ptr i64 %i to ptr
  store i32 10, ptr %g, align 4
  %z = call i1 @test25a()
  ret i1 %z
}
Transformation doesn't verify! (not unsound)
ERROR: Timeout
-- 128. PassManager<Function> : Skipping NOP
-- 129. PassManager<Function> : Skipping NOP
-- 130. InstCombinePass

----------------------------------------
declare i1 @test26a()

define i1 @test26(i32 %n) {
entry:
  %a = alloca i64 4, align 4
  %i = ptrtoint ptr %a to i64
  %b = call i1 @test26a()
  br label %one

one:
  %x = phi i64 [ %y, %two ], [ %w, %three ], [ %i, %entry ]
  %c = call i1 @test26a()
  switch i32 %n, label %end [
    i32 2, label %two
    i32 3, label %three
  ]

three:
  %w = phi i64 [ %y, %two ], [ %x, %one ]
  %e = call i1 @test26a()
  br i1 %e, label %one, label %two

two:
  %y = phi i64 [ %x, %one ], [ %w, %three ]
  %d = call i1 @test26a()
  switch i32 %n, label %end [
    i32 10, label %one
    i32 30, label %three
  ]

end:
  %f = phi i64 [ %x, %one ], [ %y, %two ]
  %g = int2ptr i64 %f to ptr
  store i32 10, ptr %g, align 4
  %z = call i1 @test26a()
  ret i1 %z
}
Transformation seems to be correct! (syntactically equal)

-- 131. InstCombinePass

----------------------------------------
declare i1 @test26a()

define i1 @test26(i32 %n) {
entry:
  %a = alloca i64 4, align 4
  %i = ptrtoint ptr %a to i64
  %b = call i1 @test26a()
  br label %one

one:
  %x = phi i64 [ %y, %two ], [ %w, %three ], [ %i, %entry ]
  %c = call i1 @test26a()
  switch i32 %n, label %end [
    i32 2, label %two
    i32 3, label %three
  ]

three:
  %w = phi i64 [ %y, %two ], [ %x, %one ]
  %e = call i1 @test26a()
  br i1 %e, label %one, label %two

two:
  %y = phi i64 [ %x, %one ], [ %w, %three ]
  %d = call i1 @test26a()
  switch i32 %n, label %end [
    i32 10, label %one
    i32 30, label %three
  ]

end:
  %f = phi i64 [ %x, %one ], [ %y, %two ]
  %g = int2ptr i64 %f to ptr
  store i32 10, ptr %g, align 4
  %z = call i1 @test26a()
  ret i1 %z
}
=>
declare i1 @test26a()

define i1 @test26(i32 %n) {
entry:
  %b = call i1 @test26a()
  br label %one

one:
  %c = call i1 @test26a()
  switch i32 %n, label %end [
    i32 2, label %two
    i32 3, label %three
  ]

three:
  %e = call i1 @test26a()
  br i1 %e, label %one, label %two

two:
  %d = call i1 @test26a()
  switch i32 %n, label %end [
    i32 10, label %one
    i32 30, label %three
  ]

end:
  %z = call i1 @test26a()
  ret i1 %z
}
Transformation doesn't verify! (not unsound)
ERROR: Timeout
-- 132. PassManager<Function> : Skipping NOP
-- 133. PassManager<Function> : Skipping NOP
-- 134. InstCombinePass

----------------------------------------
define i32 @test27(i1 %b) {
entry:
  br label %done

done:
  %y = phi i32 [ undef, %entry ]
  ret i32 %y
}
Transformation seems to be correct! (syntactically equal)

-- 135. InstCombinePass

----------------------------------------
define i32 @test27(i1 %b) {
entry:
  br label %done

done:
  %y = phi i32 [ undef, %entry ]
  ret i32 %y
}
=>
define i32 @test27(i1 %b) {
entry:
  br label %done

done:
  ret i32 undef
}
Transformation seems to be correct!

-- 136. PassManager<Function> : Skipping NOP
-- 137. PassManager<Function> : Skipping NOP
-- 138. InstCombinePass

----------------------------------------
define i1 @PR24766(i8 %x1, i8 %x2, i8 %condition) {
entry:
  %conv = sext i8 %condition to i32
  switch i32 %conv, label %epilog [
    i32 0, label %sw1
    i32 1, label %sw2
  ]

sw2:
  %cmp2 = icmp sle i8 %x1, %x2
  %frombool2 = zext i1 %cmp2 to i8
  br label %epilog

sw1:
  %cmp1 = icmp eq i8 %x1, %x2
  %frombool1 = zext i1 %cmp1 to i8
  br label %epilog

epilog:
  %conditionMet = phi i8 [ 0, %entry ], [ %frombool2, %sw2 ], [ %frombool1, %sw1 ]
  %tobool = icmp ne i8 %conditionMet, 0
  ret i1 %tobool
}
Transformation seems to be correct! (syntactically equal)

-- 139. InstCombinePass

----------------------------------------
define i1 @PR24766(i8 %x1, i8 %x2, i8 %condition) {
entry:
  %conv = sext i8 %condition to i32
  switch i32 %conv, label %epilog [
    i32 0, label %sw1
    i32 1, label %sw2
  ]

sw2:
  %cmp2 = icmp sle i8 %x1, %x2
  %frombool2 = zext i1 %cmp2 to i8
  br label %epilog

sw1:
  %cmp1 = icmp eq i8 %x1, %x2
  %frombool1 = zext i1 %cmp1 to i8
  br label %epilog

epilog:
  %conditionMet = phi i8 [ 0, %entry ], [ %frombool2, %sw2 ], [ %frombool1, %sw1 ]
  %tobool = icmp ne i8 %conditionMet, 0
  ret i1 %tobool
}
=>
define i1 @PR24766(i8 %x1, i8 %x2, i8 %condition) {
entry:
  switch i8 %condition, label %epilog [
    i8 0, label %sw1
    i8 1, label %sw2
  ]

sw2:
  %cmp2 = icmp sle i8 %x1, %x2
  br label %epilog

sw1:
  %cmp1 = icmp eq i8 %x1, %x2
  br label %epilog

epilog:
  %conditionMet.shrunk = phi i1 [ 0, %entry ], [ %cmp2, %sw2 ], [ %cmp1, %sw1 ]
  ret i1 %conditionMet.shrunk
}
Transformation seems to be correct!

-- 140. PassManager<Function> : Skipping NOP
-- 141. PassManager<Function> : Skipping NOP
-- 142. InstCombinePass

----------------------------------------
define i1 @PR24766_no_constants(i8 %x1, i8 %x2, i8 %condition, i1 %another_condition) {
entry:
  %frombool0 = zext i1 %another_condition to i8
  %conv = sext i8 %condition to i32
  switch i32 %conv, label %epilog [
    i32 0, label %sw1
    i32 1, label %sw2
  ]

sw2:
  %cmp2 = icmp sle i8 %x1, %x2
  %frombool2 = zext i1 %cmp2 to i8
  br label %epilog

sw1:
  %cmp1 = icmp eq i8 %x1, %x2
  %frombool1 = zext i1 %cmp1 to i8
  br label %epilog

epilog:
  %conditionMet = phi i8 [ %frombool0, %entry ], [ %frombool2, %sw2 ], [ %frombool1, %sw1 ]
  %tobool = icmp ne i8 %conditionMet, 0
  ret i1 %tobool
}
Transformation seems to be correct! (syntactically equal)

-- 143. InstCombinePass

----------------------------------------
define i1 @PR24766_no_constants(i8 %x1, i8 %x2, i8 %condition, i1 %another_condition) {
entry:
  %frombool0 = zext i1 %another_condition to i8
  %conv = sext i8 %condition to i32
  switch i32 %conv, label %epilog [
    i32 0, label %sw1
    i32 1, label %sw2
  ]

sw2:
  %cmp2 = icmp sle i8 %x1, %x2
  %frombool2 = zext i1 %cmp2 to i8
  br label %epilog

sw1:
  %cmp1 = icmp eq i8 %x1, %x2
  %frombool1 = zext i1 %cmp1 to i8
  br label %epilog

epilog:
  %conditionMet = phi i8 [ %frombool0, %entry ], [ %frombool2, %sw2 ], [ %frombool1, %sw1 ]
  %tobool = icmp ne i8 %conditionMet, 0
  ret i1 %tobool
}
=>
define i1 @PR24766_no_constants(i8 %x1, i8 %x2, i8 %condition, i1 %another_condition) {
entry:
  switch i8 %condition, label %epilog [
    i8 0, label %sw1
    i8 1, label %sw2
  ]

sw2:
  %cmp2 = icmp sle i8 %x1, %x2
  br label %epilog

sw1:
  %cmp1 = icmp eq i8 %x1, %x2
  br label %epilog

epilog:
  %conditionMet.in = phi i1 [ %another_condition, %entry ], [ %cmp2, %sw2 ], [ %cmp1, %sw1 ]
  ret i1 %conditionMet.in
}
Transformation seems to be correct!

-- 144. PassManager<Function> : Skipping NOP
-- 145. PassManager<Function> : Skipping NOP
-- 146. InstCombinePass

----------------------------------------
define i1 @PR24766_two_constants(i8 %x1, i8 %x2, i8 %condition) {
entry:
  %conv = sext i8 %condition to i32
  switch i32 %conv, label %epilog [
    i32 0, label %sw1
    i32 1, label %sw2
  ]

sw2:
  %cmp2 = icmp sle i8 %x1, %x2
  %frombool2 = zext i1 %cmp2 to i8
  br label %epilog

sw1:
  %cmp1 = icmp eq i8 %x1, %x2
  %frombool1 = zext i1 %cmp1 to i8
  br label %epilog

epilog:
  %conditionMet = phi i8 [ 0, %entry ], [ 1, %sw2 ], [ %frombool1, %sw1 ]
  %tobool = icmp ne i8 %conditionMet, 0
  ret i1 %tobool
}
Transformation seems to be correct! (syntactically equal)

-- 147. InstCombinePass

----------------------------------------
define i1 @PR24766_two_constants(i8 %x1, i8 %x2, i8 %condition) {
entry:
  %conv = sext i8 %condition to i32
  switch i32 %conv, label %epilog [
    i32 0, label %sw1
    i32 1, label %sw2
  ]

sw2:
  br label %epilog

sw1:
  %cmp1 = icmp eq i8 %x1, %x2
  %frombool1 = zext i1 %cmp1 to i8
  br label %epilog

epilog:
  %conditionMet = phi i8 [ 0, %entry ], [ 1, %sw2 ], [ %frombool1, %sw1 ]
  %tobool = icmp ne i8 %conditionMet, 0
  ret i1 %tobool
}
=>
define i1 @PR24766_two_constants(i8 %x1, i8 %x2, i8 %condition) {
entry:
  switch i8 %condition, label %epilog [
    i8 0, label %sw1
    i8 1, label %sw2
  ]

sw2:
  br label %epilog

sw1:
  %cmp1 = icmp eq i8 %x1, %x2
  br label %epilog

epilog:
  %conditionMet = phi i1 [ 0, %entry ], [ 1, %sw2 ], [ %cmp1, %sw1 ]
  ret i1 %conditionMet
}
Transformation seems to be correct!

-- 148. PassManager<Function> : Skipping NOP
-- 149. PassManager<Function> : Skipping NOP
-- 150. InstCombinePass

----------------------------------------
define i1 @PR24766_two_constants_two_var(i8 %x1, i8 %x2, i8 %condition) {
entry:
  %conv = sext i8 %condition to i32
  switch i32 %conv, label %epilog [
    i32 0, label %sw1
    i32 1, label %sw2
    i32 2, label %sw3
  ]

sw3:
  %cmp3 = icmp sge i8 %x1, %x2
  %frombool3 = zext i1 %cmp3 to i8
  br label %epilog

sw2:
  %cmp2 = icmp sle i8 %x1, %x2
  %frombool2 = zext i1 %cmp2 to i8
  br label %epilog

sw1:
  %cmp1 = icmp eq i8 %x1, %x2
  %frombool1 = zext i1 %cmp1 to i8
  br label %epilog

epilog:
  %conditionMet = phi i8 [ 0, %entry ], [ %frombool2, %sw2 ], [ %frombool1, %sw1 ], [ 1, %sw3 ]
  %tobool = icmp ne i8 %conditionMet, 0
  ret i1 %tobool
}
Transformation seems to be correct! (syntactically equal)

-- 151. InstCombinePass

----------------------------------------
define i1 @PR24766_two_constants_two_var(i8 %x1, i8 %x2, i8 %condition) {
entry:
  %conv = sext i8 %condition to i32
  switch i32 %conv, label %epilog [
    i32 0, label %sw1
    i32 1, label %sw2
    i32 2, label %sw3
  ]

sw3:
  br label %epilog

sw2:
  %cmp2 = icmp sle i8 %x1, %x2
  %frombool2 = zext i1 %cmp2 to i8
  br label %epilog

sw1:
  %cmp1 = icmp eq i8 %x1, %x2
  %frombool1 = zext i1 %cmp1 to i8
  br label %epilog

epilog:
  %conditionMet = phi i8 [ 0, %entry ], [ %frombool2, %sw2 ], [ %frombool1, %sw1 ], [ 1, %sw3 ]
  %tobool = icmp ne i8 %conditionMet, 0
  ret i1 %tobool
}
=>
define i1 @PR24766_two_constants_two_var(i8 %x1, i8 %x2, i8 %condition) {
entry:
  switch i8 %condition, label %epilog [
    i8 0, label %sw1
    i8 1, label %sw2
    i8 2, label %sw3
  ]

sw3:
  br label %epilog

sw2:
  %cmp2 = icmp sle i8 %x1, %x2
  br label %epilog

sw1:
  %cmp1 = icmp eq i8 %x1, %x2
  br label %epilog

epilog:
  %conditionMet.shrunk = phi i1 [ 0, %entry ], [ %cmp2, %sw2 ], [ %cmp1, %sw1 ], [ 1, %sw3 ]
  ret i1 %conditionMet.shrunk
}
Transformation seems to be correct!

-- 152. PassManager<Function> : Skipping NOP
-- 153. PassManager<Function> : Skipping NOP
-- 154. InstCombinePass

----------------------------------------
declare void @dummy()

define i1 @phi_allnonzeroconstant(i1 %c, i32 %a, i32 %b) {
entry:
  br i1 %c, label %if.then, label %if.else

if.else:
  call void @dummy()
  br label %if.end

if.then:
  br label %if.end

if.end:
  %x.0 = phi i32 [ 1, %if.then ], [ 2, %if.else ]
  %or = or i32 %x.0, %a
  %cmp1 = icmp eq i32 %or, 0
  ret i1 %cmp1
}
Transformation seems to be correct! (syntactically equal)

-- 155. InstCombinePass

----------------------------------------
declare void @dummy()

define i1 @phi_allnonzeroconstant(i1 %c, i32 %a, i32 %b) {
entry:
  br i1 %c, label %if.then, label %if.else

if.else:
  call void @dummy()
  br label %if.end

if.then:
  br label %if.end

if.end:
  %x.0 = phi i32 [ 1, %if.then ], [ 2, %if.else ]
  %or = or i32 %x.0, %a
  %cmp1 = icmp eq i32 %or, 0
  ret i1 %cmp1
}
=>
declare void @dummy()

define i1 @phi_allnonzeroconstant(i1 %c, i32 %a, i32 %b) {
entry:
  br i1 %c, label %if.then, label %if.else

if.else:
  call void @dummy()
  br label %if.end

if.then:
  br label %if.end

if.end:
  ret i1 0
}
Transformation seems to be correct!

-- 156. PassManager<Function> : Skipping NOP
-- 157. PassManager<Function> : Skipping NOP
-- 158. InstCombinePass

----------------------------------------
declare void @dummy()

define i1 @phi_allnonzerononconstant(i1 %c, i32 %a, ptr nonnull %b1, ptr nonnull %b2) {
entry:
  br i1 %c, label %if.then, label %if.else

if.else:
  call void @dummy()
  br label %if.end

if.then:
  br label %if.end

if.end:
  %x.0 = phi ptr [ nonnull %b1, %if.then ], [ nonnull %b2, %if.else ]
  %cmp1 = icmp eq ptr %x.0, null
  ret i1 %cmp1
}
Transformation seems to be correct! (syntactically equal)

-- 159. InstCombinePass

----------------------------------------
declare void @dummy()

define i1 @phi_allnonzerononconstant(i1 %c, i32 %a, ptr nonnull %b1, ptr nonnull %b2) {
entry:
  br i1 %c, label %if.then, label %if.else

if.else:
  call void @dummy()
  br label %if.end

if.then:
  br label %if.end

if.end:
  %x.0 = phi ptr [ nonnull %b1, %if.then ], [ nonnull %b2, %if.else ]
  %cmp1 = icmp eq ptr %x.0, null
  ret i1 %cmp1
}
=>
declare void @dummy()

define i1 @phi_allnonzerononconstant(i1 %c, i32 %a, ptr nonnull %b1, ptr nonnull %b2) {
entry:
  br i1 %c, label %if.then, label %if.else

if.else:
  call void @dummy()
  br label %if.end

if.then:
  br label %if.end

if.end:
  ret i1 0
}
Transformation seems to be correct!

-- 160. PassManager<Function> : Skipping NOP
-- 161. PassManager<Function> : Skipping NOP
-- 162. InstCombinePass

----------------------------------------
define i1 @phi_knownnonzero_eq(i32 %n, i32 %s, ptr nocapture nowrite %P) {
entry:
  %tobool = icmp slt i32 %n, %s
  br i1 %tobool, label %if.end, label %if.then

if.then:
  %#0 = load i32, ptr nocapture nowrite %P, align 4
  %cmp = icmp eq i32 %n, %#0
  %#1 = select i1 %cmp, i32 1, i32 2
  br label %if.end

if.end:
  %a.0 = phi i32 [ %#1, %if.then ], [ %n, %entry ]
  %cmp1 = icmp eq i32 %a.0, 0
  ret i1 %cmp1
}
Transformation seems to be correct! (syntactically equal)

-- 163. InstCombinePass

----------------------------------------
define i1 @phi_knownnonzero_eq(i32 %n, i32 %s, ptr nocapture nowrite %P) {
entry:
  %tobool = icmp slt i32 %n, %s
  br i1 %tobool, label %if.end, label %if.then

if.then:
  %#0 = load i32, ptr nocapture nowrite %P, align 4
  %cmp = icmp eq i32 %n, %#0
  %#1 = select i1 %cmp, i32 1, i32 2
  br label %if.end

if.end:
  %a.0 = phi i32 [ %#1, %if.then ], [ %n, %entry ]
  %cmp1 = icmp eq i32 %a.0, 0
  ret i1 %cmp1
}
=>
define i1 @phi_knownnonzero_eq(i32 %n, i32 %s, ptr nocapture nowrite %P) {
entry:
  %tobool = icmp slt i32 %n, %s
  br i1 %tobool, label %if.end, label %if.then

if.then:
  br label %if.end

if.end:
  %a.0 = phi i32 [ 1, %if.then ], [ %n, %entry ]
  %cmp1 = icmp eq i32 %a.0, 0
  ret i1 %cmp1
}
Transformation seems to be correct!

-- 164. PassManager<Function> : Skipping NOP
-- 165. PassManager<Function> : Skipping NOP
-- 166. InstCombinePass

----------------------------------------
define i1 @phi_knownnonzero_ne(i32 %n, i32 %s, ptr nocapture nowrite %P) {
entry:
  %tobool = icmp slt i32 %n, %s
  br i1 %tobool, label %if.end, label %if.then

if.then:
  %#0 = load i32, ptr nocapture nowrite %P, align 4
  %cmp = icmp eq i32 %n, %#0
  %#1 = select i1 %cmp, i32 1, i32 2
  br label %if.end

if.end:
  %a.0 = phi i32 [ %#1, %if.then ], [ %n, %entry ]
  %cmp1 = icmp ne i32 %a.0, 0
  ret i1 %cmp1
}
Transformation seems to be correct! (syntactically equal)

-- 167. InstCombinePass

----------------------------------------
define i1 @phi_knownnonzero_ne(i32 %n, i32 %s, ptr nocapture nowrite %P) {
entry:
  %tobool = icmp slt i32 %n, %s
  br i1 %tobool, label %if.end, label %if.then

if.then:
  %#0 = load i32, ptr nocapture nowrite %P, align 4
  %cmp = icmp eq i32 %n, %#0
  %#1 = select i1 %cmp, i32 1, i32 2
  br label %if.end

if.end:
  %a.0 = phi i32 [ %#1, %if.then ], [ %n, %entry ]
  %cmp1 = icmp ne i32 %a.0, 0
  ret i1 %cmp1
}
=>
define i1 @phi_knownnonzero_ne(i32 %n, i32 %s, ptr nocapture nowrite %P) {
entry:
  %tobool = icmp slt i32 %n, %s
  br i1 %tobool, label %if.end, label %if.then

if.then:
  br label %if.end

if.end:
  %a.0 = phi i32 [ 1, %if.then ], [ %n, %entry ]
  %cmp1 = icmp ne i32 %a.0, 0
  ret i1 %cmp1
}
Transformation seems to be correct!

-- 168. PassManager<Function> : Skipping NOP
-- 169. PassManager<Function> : Skipping NOP
-- 170. InstCombinePass

----------------------------------------
define i1 @phi_knownnonzero_eq_2(i32 %n, i32 %s, ptr nocapture nowrite %P) {
entry:
  %tobool = icmp slt i32 %n, %s
  br i1 %tobool, label %if.then, label %if.end

if.then:
  %tobool2 = icmp slt i32 %n, %s
  br i1 %tobool2, label %if.else, label %if.end

if.else:
  %#0 = load i32, ptr nocapture nowrite %P, align 4
  %cmp = icmp eq i32 %n, %#0
  %#1 = select i1 %cmp, i32 1, i32 2
  br label %if.end

if.end:
  %a.0 = phi i32 [ %#1, %if.else ], [ %n, %entry ], [ 2, %if.then ]
  %cmp1 = icmp eq i32 %a.0, 0
  ret i1 %cmp1
}
Transformation seems to be correct! (syntactically equal)

-- 171. InstCombinePass

----------------------------------------
define i1 @phi_knownnonzero_eq_2(i32 %n, i32 %s, ptr nocapture nowrite %P) {
entry:
  %tobool = icmp slt i32 %n, %s
  br i1 %tobool, label %if.then, label %if.end

if.then:
  %tobool2 = icmp slt i32 %n, %s
  br i1 %tobool2, label %if.else, label %if.end

if.else:
  %#0 = load i32, ptr nocapture nowrite %P, align 4
  %cmp = icmp eq i32 %n, %#0
  %#1 = select i1 %cmp, i32 1, i32 2
  br label %if.end

if.end:
  %a.0 = phi i32 [ %#1, %if.else ], [ %n, %entry ], [ 2, %if.then ]
  %cmp1 = icmp eq i32 %a.0, 0
  ret i1 %cmp1
}
=>
define i1 @phi_knownnonzero_eq_2(i32 %n, i32 %s, ptr nocapture nowrite %P) {
entry:
  %tobool = icmp slt i32 %n, %s
  br i1 %tobool, label %if.then, label %if.end

if.then:
  br i1 1, label %if.else, label %if.end

if.else:
  br label %if.end

if.end:
  %a.0 = phi i32 [ 1, %if.else ], [ %n, %entry ], [ poison, %if.then ]
  %cmp1 = icmp eq i32 %a.0, 0
  ret i1 %cmp1
}
Transformation seems to be correct!

-- 172. PassManager<Function> : Skipping NOP
-- 173. PassManager<Function> : Skipping NOP
-- 174. InstCombinePass

----------------------------------------
define i1 @phi_knownnonzero_ne_2(i32 %n, i32 %s, ptr nocapture nowrite %P) {
entry:
  %tobool = icmp slt i32 %n, %s
  br i1 %tobool, label %if.then, label %if.end

if.then:
  %tobool2 = icmp slt i32 %n, %s
  br i1 %tobool2, label %if.else, label %if.end

if.else:
  %#0 = load i32, ptr nocapture nowrite %P, align 4
  %cmp = icmp eq i32 %n, %#0
  %#1 = select i1 %cmp, i32 1, i32 2
  br label %if.end

if.end:
  %a.0 = phi i32 [ %#1, %if.else ], [ %n, %entry ], [ 2, %if.then ]
  %cmp1 = icmp ne i32 %a.0, 0
  ret i1 %cmp1
}
Transformation seems to be correct! (syntactically equal)

-- 175. InstCombinePass

----------------------------------------
define i1 @phi_knownnonzero_ne_2(i32 %n, i32 %s, ptr nocapture nowrite %P) {
entry:
  %tobool = icmp slt i32 %n, %s
  br i1 %tobool, label %if.then, label %if.end

if.then:
  %tobool2 = icmp slt i32 %n, %s
  br i1 %tobool2, label %if.else, label %if.end

if.else:
  %#0 = load i32, ptr nocapture nowrite %P, align 4
  %cmp = icmp eq i32 %n, %#0
  %#1 = select i1 %cmp, i32 1, i32 2
  br label %if.end

if.end:
  %a.0 = phi i32 [ %#1, %if.else ], [ %n, %entry ], [ 2, %if.then ]
  %cmp1 = icmp ne i32 %a.0, 0
  ret i1 %cmp1
}
=>
define i1 @phi_knownnonzero_ne_2(i32 %n, i32 %s, ptr nocapture nowrite %P) {
entry:
  %tobool = icmp slt i32 %n, %s
  br i1 %tobool, label %if.then, label %if.end

if.then:
  br i1 1, label %if.else, label %if.end

if.else:
  br label %if.end

if.end:
  %a.0 = phi i32 [ 1, %if.else ], [ %n, %entry ], [ poison, %if.then ]
  %cmp1 = icmp ne i32 %a.0, 0
  ret i1 %cmp1
}
Transformation seems to be correct!

-- 176. PassManager<Function> : Skipping NOP
-- 177. PassManager<Function> : Skipping NOP
-- 178. InstCombinePass

----------------------------------------
define i1 @phi_knownnonzero_eq_oricmp(i32 %n, i32 %s, ptr %P, i32 %val) {
entry:
  %tobool = icmp slt i32 %n, %s
  br i1 %tobool, label %if.end, label %if.then

if.then:
  %load = load i32, ptr %P, align 4
  %cmp = icmp eq i32 %n, %load
  %sel = select i1 %cmp, i32 1, i32 2
  br label %if.end

if.end:
  %phi = phi i32 [ %sel, %if.then ], [ %n, %entry ]
  %orphi = or i32 %phi, %val
  %cmp1 = icmp eq i32 %orphi, 0
  ret i1 %cmp1
}
Transformation seems to be correct! (syntactically equal)

-- 179. InstCombinePass

----------------------------------------
define i1 @phi_knownnonzero_eq_oricmp(i32 %n, i32 %s, ptr %P, i32 %val) {
entry:
  %tobool = icmp slt i32 %n, %s
  br i1 %tobool, label %if.end, label %if.then

if.then:
  %load = load i32, ptr %P, align 4
  %cmp = icmp eq i32 %n, %load
  %sel = select i1 %cmp, i32 1, i32 2
  br label %if.end

if.end:
  %phi = phi i32 [ %sel, %if.then ], [ %n, %entry ]
  %orphi = or i32 %phi, %val
  %cmp1 = icmp eq i32 %orphi, 0
  ret i1 %cmp1
}
=>
define i1 @phi_knownnonzero_eq_oricmp(i32 %n, i32 %s, ptr %P, i32 %val) {
entry:
  %tobool = icmp slt i32 %n, %s
  br i1 %tobool, label %if.end, label %if.then

if.then:
  br label %if.end

if.end:
  %phi = phi i32 [ 1, %if.then ], [ %n, %entry ]
  %orphi = or i32 %phi, %val
  %cmp1 = icmp eq i32 %orphi, 0
  ret i1 %cmp1
}
Transformation seems to be correct!

-- 180. PassManager<Function> : Skipping NOP
-- 181. PassManager<Function> : Skipping NOP
-- 182. InstCombinePass

----------------------------------------
define i1 @phi_knownnonzero_eq_oricmp_commuted(i32 %n, i32 %s, ptr %P, i32 %val) {
entry:
  %tobool = icmp slt i32 %n, %s
  br i1 %tobool, label %if.end, label %if.then

if.then:
  %load = load i32, ptr %P, align 4
  %cmp = icmp eq i32 %n, %load
  %sel = select i1 %cmp, i32 1, i32 2
  br label %if.end

if.end:
  %phi = phi i32 [ %sel, %if.then ], [ %n, %entry ]
  %orphi = or i32 %val, %phi
  %cmp1 = icmp eq i32 %orphi, 0
  ret i1 %cmp1
}
Transformation seems to be correct! (syntactically equal)

-- 183. InstCombinePass

----------------------------------------
define i1 @phi_knownnonzero_eq_oricmp_commuted(i32 %n, i32 %s, ptr %P, i32 %val) {
entry:
  %tobool = icmp slt i32 %n, %s
  br i1 %tobool, label %if.end, label %if.then

if.then:
  %load = load i32, ptr %P, align 4
  %cmp = icmp eq i32 %n, %load
  %sel = select i1 %cmp, i32 1, i32 2
  br label %if.end

if.end:
  %phi = phi i32 [ %sel, %if.then ], [ %n, %entry ]
  %orphi = or i32 %val, %phi
  %cmp1 = icmp eq i32 %orphi, 0
  ret i1 %cmp1
}
=>
define i1 @phi_knownnonzero_eq_oricmp_commuted(i32 %n, i32 %s, ptr %P, i32 %val) {
entry:
  %tobool = icmp slt i32 %n, %s
  br i1 %tobool, label %if.end, label %if.then

if.then:
  br label %if.end

if.end:
  %phi = phi i32 [ 1, %if.then ], [ %n, %entry ]
  %orphi = or i32 %val, %phi
  %cmp1 = icmp eq i32 %orphi, 0
  ret i1 %cmp1
}
Transformation seems to be correct!

-- 184. PassManager<Function> : Skipping NOP
-- 185. PassManager<Function> : Skipping NOP
-- 186. InstCombinePass

----------------------------------------
define i1 @phi_knownnonzero_eq_or_disjoint_icmp(i32 %n, i32 %s, ptr %P, i32 %val) {
entry:
  %tobool = icmp slt i32 %n, %s
  br i1 %tobool, label %if.end, label %if.then

if.then:
  %load = load i32, ptr %P, align 4
  %cmp = icmp eq i32 %n, %load
  %sel = select i1 %cmp, i32 1, i32 2
  br label %if.end

if.end:
  %phi = phi i32 [ %sel, %if.then ], [ %n, %entry ]
  %orphi = or disjoint i32 %phi, %val
  %cmp1 = icmp eq i32 %orphi, 0
  ret i1 %cmp1
}
Transformation seems to be correct! (syntactically equal)

-- 187. InstCombinePass

----------------------------------------
define i1 @phi_knownnonzero_eq_or_disjoint_icmp(i32 %n, i32 %s, ptr %P, i32 %val) {
entry:
  %tobool = icmp slt i32 %n, %s
  br i1 %tobool, label %if.end, label %if.then

if.then:
  %load = load i32, ptr %P, align 4
  %cmp = icmp eq i32 %n, %load
  %sel = select i1 %cmp, i32 1, i32 2
  br label %if.end

if.end:
  %phi = phi i32 [ %sel, %if.then ], [ %n, %entry ]
  %orphi = or disjoint i32 %phi, %val
  %cmp1 = icmp eq i32 %orphi, 0
  ret i1 %cmp1
}
=>
define i1 @phi_knownnonzero_eq_or_disjoint_icmp(i32 %n, i32 %s, ptr %P, i32 %val) {
entry:
  %tobool = icmp slt i32 %n, %s
  br i1 %tobool, label %if.end, label %if.then

if.then:
  br label %if.end

if.end:
  %phi = phi i32 [ 1, %if.then ], [ %n, %entry ]
  %orphi = or i32 %phi, %val
  %cmp1 = icmp eq i32 %orphi, 0
  ret i1 %cmp1
}
Transformation seems to be correct!

-- 188. PassManager<Function> : Skipping NOP
-- 189. PassManager<Function> : Skipping NOP
-- 190. InstCombinePass

----------------------------------------
define i1 @phi_knownnonzero_ne_oricmp(i32 %n, i32 %s, ptr %P, i32 %val) {
entry:
  %tobool = icmp slt i32 %n, %s
  br i1 %tobool, label %if.end, label %if.then

if.then:
  %load = load i32, ptr %P, align 4
  %cmp = icmp eq i32 %n, %load
  %sel = select i1 %cmp, i32 1, i32 2
  br label %if.end

if.end:
  %phi = phi i32 [ %sel, %if.then ], [ %n, %entry ]
  %orphi = or i32 %phi, %val
  %cmp1 = icmp ne i32 %orphi, 0
  ret i1 %cmp1
}
Transformation seems to be correct! (syntactically equal)

-- 191. InstCombinePass

----------------------------------------
define i1 @phi_knownnonzero_ne_oricmp(i32 %n, i32 %s, ptr %P, i32 %val) {
entry:
  %tobool = icmp slt i32 %n, %s
  br i1 %tobool, label %if.end, label %if.then

if.then:
  %load = load i32, ptr %P, align 4
  %cmp = icmp eq i32 %n, %load
  %sel = select i1 %cmp, i32 1, i32 2
  br label %if.end

if.end:
  %phi = phi i32 [ %sel, %if.then ], [ %n, %entry ]
  %orphi = or i32 %phi, %val
  %cmp1 = icmp ne i32 %orphi, 0
  ret i1 %cmp1
}
=>
define i1 @phi_knownnonzero_ne_oricmp(i32 %n, i32 %s, ptr %P, i32 %val) {
entry:
  %tobool = icmp slt i32 %n, %s
  br i1 %tobool, label %if.end, label %if.then

if.then:
  br label %if.end

if.end:
  %phi = phi i32 [ 1, %if.then ], [ %n, %entry ]
  %orphi = or i32 %phi, %val
  %cmp1 = icmp ne i32 %orphi, 0
  ret i1 %cmp1
}
Transformation seems to be correct!

-- 192. PassManager<Function> : Skipping NOP
-- 193. PassManager<Function> : Skipping NOP
-- 194. InstCombinePass

----------------------------------------
define i1 @phi_knownnonzero_ne_oricmp_commuted(i32 %n, i32 %s, ptr %P, i32 %val) {
entry:
  %tobool = icmp slt i32 %n, %s
  br i1 %tobool, label %if.end, label %if.then

if.then:
  %load = load i32, ptr %P, align 4
  %cmp = icmp eq i32 %n, %load
  %sel = select i1 %cmp, i32 1, i32 2
  br label %if.end

if.end:
  %phi = phi i32 [ %sel, %if.then ], [ %n, %entry ]
  %orphi = or i32 %val, %phi
  %cmp1 = icmp ne i32 %orphi, 0
  ret i1 %cmp1
}
Transformation seems to be correct! (syntactically equal)

-- 195. InstCombinePass

----------------------------------------
define i1 @phi_knownnonzero_ne_oricmp_commuted(i32 %n, i32 %s, ptr %P, i32 %val) {
entry:
  %tobool = icmp slt i32 %n, %s
  br i1 %tobool, label %if.end, label %if.then

if.then:
  %load = load i32, ptr %P, align 4
  %cmp = icmp eq i32 %n, %load
  %sel = select i1 %cmp, i32 1, i32 2
  br label %if.end

if.end:
  %phi = phi i32 [ %sel, %if.then ], [ %n, %entry ]
  %orphi = or i32 %val, %phi
  %cmp1 = icmp ne i32 %orphi, 0
  ret i1 %cmp1
}
=>
define i1 @phi_knownnonzero_ne_oricmp_commuted(i32 %n, i32 %s, ptr %P, i32 %val) {
entry:
  %tobool = icmp slt i32 %n, %s
  br i1 %tobool, label %if.end, label %if.then

if.then:
  br label %if.end

if.end:
  %phi = phi i32 [ 1, %if.then ], [ %n, %entry ]
  %orphi = or i32 %val, %phi
  %cmp1 = icmp ne i32 %orphi, 0
  ret i1 %cmp1
}
Transformation seems to be correct!

-- 196. PassManager<Function> : Skipping NOP
-- 197. PassManager<Function> : Skipping NOP
-- 198. InstCombinePass

----------------------------------------
define i1 @phi_knownnonzero_eq_multiuse_oricmp(i32 %n, i32 %s, ptr %P, i32 %val) {
entry:
  %tobool = icmp slt i32 %n, %s
  br i1 %tobool, label %if.end, label %if.then

if.then:
  %load = load i32, ptr %P, align 4
  %cmp = icmp eq i32 %n, %load
  %sel = select i1 %cmp, i32 1, i32 2
  br label %if.end

if.end:
  %phi = phi i32 [ %sel, %if.then ], [ %n, %entry ]
  %orphi = or i32 %phi, %val
  %cmp1 = icmp eq i32 %orphi, 0
  br i1 %cmp1, label %next, label %cleanup

next:
  %bool2 = icmp eq i32 %phi, 0
  br label %cleanup

cleanup:
  %final = phi i1 [ %cmp1, %if.end ], [ %bool2, %next ]
  ret i1 %final
}
Transformation seems to be correct! (syntactically equal)

-- 199. InstCombinePass

----------------------------------------
define i1 @phi_knownnonzero_eq_multiuse_oricmp(i32 %n, i32 %s, ptr %P, i32 %val) {
entry:
  %tobool = icmp slt i32 %n, %s
  br i1 %tobool, label %if.end, label %if.then

if.then:
  %load = load i32, ptr %P, align 4
  %cmp = icmp eq i32 %n, %load
  %sel = select i1 %cmp, i32 1, i32 2
  br label %if.end

if.end:
  %phi = phi i32 [ %sel, %if.then ], [ %n, %entry ]
  %orphi = or i32 %phi, %val
  %cmp1 = icmp eq i32 %orphi, 0
  br i1 %cmp1, label %next, label %cleanup

next:
  %bool2 = icmp eq i32 %phi, 0
  br label %cleanup

cleanup:
  %final = phi i1 [ %cmp1, %if.end ], [ %bool2, %next ]
  ret i1 %final
}
=>
define i1 @phi_knownnonzero_eq_multiuse_oricmp(i32 %n, i32 %s, ptr %P, i32 %val) {
entry:
  %tobool = icmp slt i32 %n, %s
  br i1 %tobool, label %if.end, label %if.then

if.then:
  br label %if.end

if.end:
  %phi = phi i32 [ 1, %if.then ], [ %n, %entry ]
  %orphi = or i32 %phi, %val
  %cmp1 = icmp eq i32 %orphi, 0
  br i1 %cmp1, label %next, label %cleanup

next:
  %bool2 = icmp eq i32 %phi, 0
  br label %cleanup

cleanup:
  %final = phi i1 [ 0, %if.end ], [ %bool2, %next ]
  ret i1 %final
}
Transformation seems to be correct!

-- 200. PassManager<Function> : Skipping NOP
-- 201. PassManager<Function> : Skipping NOP
-- 202. InstCombinePass

----------------------------------------
define i1 @phi_knownnonzero_ne_multiuse_oricmp_commuted(i32 %n, i32 %s, ptr %P, i32 %val) {
entry:
  %tobool = icmp slt i32 %n, %s
  br i1 %tobool, label %if.end, label %if.then

if.then:
  %load = load i32, ptr %P, align 4
  %cmp = icmp eq i32 %n, %load
  %sel = select i1 %cmp, i32 1, i32 2
  br label %if.end

if.end:
  %phi = phi i32 [ %sel, %if.then ], [ %n, %entry ]
  %orphi = or i32 %val, %phi
  %cmp1 = icmp ne i32 %orphi, 0
  br i1 %cmp1, label %next, label %cleanup

next:
  %bool2 = icmp ne i32 %phi, 0
  br label %cleanup

cleanup:
  %final = phi i1 [ %cmp1, %if.end ], [ %bool2, %next ]
  ret i1 %final
}
Transformation seems to be correct! (syntactically equal)

-- 203. InstCombinePass

----------------------------------------
define i1 @phi_knownnonzero_ne_multiuse_oricmp_commuted(i32 %n, i32 %s, ptr %P, i32 %val) {
entry:
  %tobool = icmp slt i32 %n, %s
  br i1 %tobool, label %if.end, label %if.then

if.then:
  %load = load i32, ptr %P, align 4
  %cmp = icmp eq i32 %n, %load
  %sel = select i1 %cmp, i32 1, i32 2
  br label %if.end

if.end:
  %phi = phi i32 [ %sel, %if.then ], [ %n, %entry ]
  %orphi = or i32 %val, %phi
  %cmp1 = icmp ne i32 %orphi, 0
  br i1 %cmp1, label %next, label %cleanup

next:
  %bool2 = icmp ne i32 %phi, 0
  br label %cleanup

cleanup:
  %final = phi i1 [ %cmp1, %if.end ], [ %bool2, %next ]
  ret i1 %final
}
=>
define i1 @phi_knownnonzero_ne_multiuse_oricmp_commuted(i32 %n, i32 %s, ptr %P, i32 %val) {
entry:
  %tobool = icmp slt i32 %n, %s
  br i1 %tobool, label %if.end, label %if.then

if.then:
  br label %if.end

if.end:
  %phi = phi i32 [ 1, %if.then ], [ %n, %entry ]
  %orphi = or i32 %val, %phi
  %cmp1.not = icmp eq i32 %orphi, 0
  br i1 %cmp1.not, label %cleanup, label %next

next:
  %bool2 = icmp ne i32 %phi, 0
  br label %cleanup

cleanup:
  %final = phi i1 [ 0, %if.end ], [ %bool2, %next ]
  ret i1 %final
}
Transformation seems to be correct!

-- 204. PassManager<Function> : Skipping NOP
-- 205. PassManager<Function> : Skipping NOP
-- 206. InstCombinePass

----------------------------------------
define i1 @phi_knownnonzero_eq_multiuse_andicmp(i32 %n, i32 %s, ptr %P, i32 %val) {
entry:
  %tobool = icmp slt i32 %n, %s
  br i1 %tobool, label %if.end, label %if.then

if.then:
  %load = load i32, ptr %P, align 4
  %cmp = icmp eq i32 %n, %load
  %sel = select i1 %cmp, i32 1, i32 2
  br label %if.end

if.end:
  %phi = phi i32 [ %sel, %if.then ], [ %n, %entry ]
  %andphi = and i32 %phi, %val
  %cmp1 = icmp eq i32 %andphi, 0
  br i1 %cmp1, label %next, label %cleanup

next:
  %bool2 = icmp eq i32 %phi, 0
  br label %cleanup

cleanup:
  %final = phi i1 [ %cmp1, %if.end ], [ %bool2, %next ]
  ret i1 %final
}
Transformation seems to be correct! (syntactically equal)

-- 207. InstCombinePass

----------------------------------------
define i1 @phi_knownnonzero_eq_multiuse_andicmp(i32 %n, i32 %s, ptr %P, i32 %val) {
entry:
  %tobool = icmp slt i32 %n, %s
  br i1 %tobool, label %if.end, label %if.then

if.then:
  %load = load i32, ptr %P, align 4
  %cmp = icmp eq i32 %n, %load
  %sel = select i1 %cmp, i32 1, i32 2
  br label %if.end

if.end:
  %phi = phi i32 [ %sel, %if.then ], [ %n, %entry ]
  %andphi = and i32 %phi, %val
  %cmp1 = icmp eq i32 %andphi, 0
  br i1 %cmp1, label %next, label %cleanup

next:
  %bool2 = icmp eq i32 %phi, 0
  br label %cleanup

cleanup:
  %final = phi i1 [ %cmp1, %if.end ], [ %bool2, %next ]
  ret i1 %final
}
=>
define i1 @phi_knownnonzero_eq_multiuse_andicmp(i32 %n, i32 %s, ptr %P, i32 %val) {
entry:
  %tobool = icmp slt i32 %n, %s
  br i1 %tobool, label %if.end, label %if.then

if.then:
  %load = load i32, ptr %P, align 4
  %cmp = icmp eq i32 %n, %load
  %sel = select i1 %cmp, i32 1, i32 2
  br label %if.end

if.end:
  %phi = phi i32 [ %sel, %if.then ], [ %n, %entry ]
  %andphi = and i32 %phi, %val
  %cmp1 = icmp eq i32 %andphi, 0
  br i1 %cmp1, label %next, label %cleanup

next:
  %bool2 = icmp eq i32 %phi, 0
  br label %cleanup

cleanup:
  %final = phi i1 [ 0, %if.end ], [ %bool2, %next ]
  ret i1 %final
}
Transformation seems to be correct!

-- 208. PassManager<Function> : Skipping NOP
-- 209. PassManager<Function> : Skipping NOP
-- 210. InstCombinePass

----------------------------------------
define i1 @phi_knownnonzero_ne_multiuse_andicmp(i32 %n, i32 %s, ptr %P, i32 %val) {
entry:
  %tobool = icmp slt i32 %n, %s
  br i1 %tobool, label %if.end, label %if.then

if.then:
  %load = load i32, ptr %P, align 4
  %cmp = icmp eq i32 %n, %load
  %sel = select i1 %cmp, i32 1, i32 2
  br label %if.end

if.end:
  %phi = phi i32 [ %sel, %if.then ], [ %n, %entry ]
  %andphi = and i32 %phi, %val
  %cmp1 = icmp ne i32 %andphi, 0
  br i1 %cmp1, label %next, label %cleanup

next:
  %bool2 = icmp ne i32 %phi, 0
  br label %cleanup

cleanup:
  %final = phi i1 [ %cmp1, %if.end ], [ %bool2, %next ]
  ret i1 %final
}
Transformation seems to be correct! (syntactically equal)

-- 211. InstCombinePass

----------------------------------------
define i1 @phi_knownnonzero_ne_multiuse_andicmp(i32 %n, i32 %s, ptr %P, i32 %val) {
entry:
  %tobool = icmp slt i32 %n, %s
  br i1 %tobool, label %if.end, label %if.then

if.then:
  %load = load i32, ptr %P, align 4
  %cmp = icmp eq i32 %n, %load
  %sel = select i1 %cmp, i32 1, i32 2
  br label %if.end

if.end:
  %phi = phi i32 [ %sel, %if.then ], [ %n, %entry ]
  %andphi = and i32 %phi, %val
  %cmp1 = icmp ne i32 %andphi, 0
  br i1 %cmp1, label %next, label %cleanup

next:
  %bool2 = icmp ne i32 %phi, 0
  br label %cleanup

cleanup:
  %final = phi i1 [ %cmp1, %if.end ], [ %bool2, %next ]
  ret i1 %final
}
=>
define i1 @phi_knownnonzero_ne_multiuse_andicmp(i32 %n, i32 %s, ptr %P, i32 %val) {
entry:
  %tobool = icmp slt i32 %n, %s
  br i1 %tobool, label %if.end, label %if.then

if.then:
  %load = load i32, ptr %P, align 4
  %cmp = icmp eq i32 %n, %load
  %sel = select i1 %cmp, i32 1, i32 2
  br label %if.end

if.end:
  %phi = phi i32 [ %sel, %if.then ], [ %n, %entry ]
  %andphi = and i32 %phi, %val
  %cmp1.not = icmp eq i32 %andphi, 0
  br i1 %cmp1.not, label %cleanup, label %next

next:
  %bool2 = icmp ne i32 %phi, 0
  br label %cleanup

cleanup:
  %final = phi i1 [ 0, %if.end ], [ %bool2, %next ]
  ret i1 %final
}
Transformation seems to be correct!

-- 212. PassManager<Function> : Skipping NOP
-- 213. PassManager<Function> : Skipping NOP
-- 214. InstCombinePass

----------------------------------------
define void @main(i1 %cond, i16 %x) {
entry:
  br label %for.cond

g.exit:
  br label %for.cond

for.cond:
  %p = phi double [ %conv, %g.exit ], [ undef, %entry ]
  br i1 %cond, label %for.end, label %for.body

for.end:
  store double %p, ptr undef, align 8
  ret void

for.body:
  %conv = sitofp i16 %x to double
  assume i1 0
}
Transformation seems to be correct! (syntactically equal)

-- 215. InstCombinePass

----------------------------------------
define void @main(i1 %cond, i16 %x) {
entry:
  br label %for.cond

for.cond:
  %p = phi double [ undef, %entry ]
  br i1 %cond, label %for.end, label %for.body

for.end:
  store double %p, ptr undef, align 8
  ret void

for.body:
  assume i1 0
}
=>
define void @main(i1 %cond, i16 %x) {
entry:
  br label %for.cond

for.cond:
  br i1 %cond, label %for.end, label %for.body

for.end:
  store double undef, ptr undef, align 8
  ret void

for.body:
  assume i1 0
}

****************************************
WARNING: Source function is always UB.
It can be refined by any target function.
Please make sure this is what you wanted.
****************************************

Transformation seems to be correct!

-- 216. PassManager<Function> : Skipping NOP
-- 217. PassManager<Function> : Skipping NOP
-- 218. InstCombinePass

----------------------------------------
define i1 @pr57488_icmp_of_phi(ptr %ptr.base, i64 %len) {
start:
  %end = gep inbounds ptr %ptr.base, 8 x i64 %len
  %len.zero = icmp eq i64 %len, 0
  br i1 %len.zero, label %exit, label %loop

loop:
  %accum = phi i8 [ %accum.next, %loop ], [ 1, %start ]
  %ptr = phi ptr [ %ptr.next, %loop ], [ %ptr.base, %start ]
  %ptr.next = gep inbounds ptr %ptr, 8 x i64 1
  %accum.bool = icmp ne i8 %accum, 0
  %val = load i64, ptr %ptr, align 8
  %val.zero = icmp eq i64 %val, 0
  %and = and i1 %accum.bool, %val.zero
  %accum.next = zext i1 %and to i8
  %exit.cond = icmp eq ptr %ptr.next, %end
  br i1 %exit.cond, label %exit, label %loop

exit:
  %res = phi i1 [ 1, %start ], [ %and, %loop ]
  ret i1 %res
}
Transformation seems to be correct! (syntactically equal)

-- 219. InstCombinePass

----------------------------------------
define i1 @pr57488_icmp_of_phi(ptr %ptr.base, i64 %len) {
start:
  %end = gep inbounds ptr %ptr.base, 8 x i64 %len
  %len.zero = icmp eq i64 %len, 0
  br i1 %len.zero, label %exit, label %loop

loop:
  %accum = phi i8 [ %accum.next, %loop ], [ 1, %start ]
  %ptr = phi ptr [ %ptr.next, %loop ], [ %ptr.base, %start ]
  %ptr.next = gep inbounds ptr %ptr, 8 x i64 1
  %accum.bool = icmp ne i8 %accum, 0
  %val = load i64, ptr %ptr, align 8
  %val.zero = icmp eq i64 %val, 0
  %and = and i1 %accum.bool, %val.zero
  %accum.next = zext i1 %and to i8
  %exit.cond = icmp eq ptr %ptr.next, %end, offsetonly
  br i1 %exit.cond, label %exit, label %loop

exit:
  %res = phi i1 [ 1, %start ], [ %and, %loop ]
  ret i1 %res
}
=>
define i1 @pr57488_icmp_of_phi(ptr %ptr.base, i64 %len) {
start:
  %end = gep inbounds ptr %ptr.base, 8 x i64 %len
  %len.zero = icmp eq i64 %len, 0
  br i1 %len.zero, label %exit, label %loop

loop:
  %accum = phi i1 [ %and, %loop ], [ 1, %start ]
  %ptr = phi ptr [ %ptr.next, %loop ], [ %ptr.base, %start ]
  %ptr.next = gep inbounds ptr %ptr, 1 x i64 8
  %val = load i64, ptr %ptr, align 8
  %val.zero = icmp eq i64 %val, 0
  %and = and i1 %accum, %val.zero
  %exit.cond = icmp eq ptr %ptr.next, %end, offsetonly
  br i1 %exit.cond, label %exit, label %loop

exit:
  %res = phi i1 [ 1, %start ], [ %and, %loop ]
  ret i1 %res
}
Transformation seems to be correct!

-- 220. PassManager<Function> : Skipping NOP
-- 221. PassManager<Function> : Skipping NOP
-- 222. InstCombinePass

----------------------------------------
declare void @use(i32)

define i32 @phi_op_self_simplify() {
entry:
  br label %loop

loop:
  %iv = phi i32 [ 1, %entry ], [ %iv.add2, %loop ]
  %iv.add = xor i32 %iv, 4294967295
  call void @use(i32 %iv.add)
  %iv.add2 = xor i32 %iv, 4294967295
  br label %loop
}
Transformation seems to be correct! (syntactically equal)

-- 223. InstCombinePass

----------------------------------------
declare void @use(i32)

define i32 @phi_op_self_simplify() {
entry:
  br label %loop

loop:
  %iv = phi i32 [ 1, %entry ], [ %iv.add2, %loop ]
  %iv.add = xor i32 %iv, 4294967295
  call void @use(i32 %iv.add)
  %iv.add2 = xor i32 %iv, 4294967295
  br label %loop
}
Transformation seems to be correct! (syntactically equal)

-- 224. PassManager<Function> : Skipping NOP
-- 225. PassManager<Function> : Skipping NOP
-- 226. InstCombinePass

----------------------------------------
declare i1 @get.i1()

define i32 @phi_op_self_simplify_2(i32 %x) {
entry:
  br label %loop

loop:
  %phi = phi i32 [ %x, %entry ], [ %or, %loop ], [ 10, %loop.latch ]
  %or = or i32 %phi, 1
  %c1 = call i1 @get.i1()
  br i1 %c1, label %loop.latch, label %loop

loop.latch:
  %c2 = call i1 @get.i1()
  br i1 %c2, label %exit, label %loop

exit:
  ret i32 %or
}
Transformation seems to be correct! (syntactically equal)

-- 227. InstCombinePass

----------------------------------------
declare i1 @get.i1()

define i32 @phi_op_self_simplify_2(i32 %x) {
entry:
  br label %loop

loop:
  %phi = phi i32 [ %x, %entry ], [ %or, %loop ], [ 10, %loop.latch ]
  %or = or i32 %phi, 1
  %c1 = call i1 @get.i1()
  br i1 %c1, label %loop.latch, label %loop

loop.latch:
  %c2 = call i1 @get.i1()
  br i1 %c2, label %exit, label %loop

exit:
  ret i32 %or
}
=>
declare i1 @get.i1()

define i32 @phi_op_self_simplify_2(i32 %x) {
entry:
  %#0 = or i32 %x, 1
  br label %loop

loop:
  %phi = phi i32 [ %#0, %entry ], [ %phi, %loop ], [ 11, %loop.latch ]
  %c1 = call i1 @get.i1()
  br i1 %c1, label %loop.latch, label %loop

loop.latch:
  %c2 = call i1 @get.i1()
  br i1 %c2, label %exit, label %loop

exit:
  ret i32 %phi
}
Transformation doesn't verify! (not unsound)
ERROR: Timeout
-- 228. PassManager<Function> : Skipping NOP
-- 229. PassManager<Function> : Skipping NOP
-- 230. InstCombinePass

----------------------------------------
define i64 @inttoptr_of_phi(i1 %c, ptr %arg.ptr, ptr %arg.ptr2) {
entry:
  br i1 %c, label %if, label %else

else:
  %arg.int.ptr = ptrtoint ptr %arg.ptr to i64
  br label %join

if:
  %arg.ptr2.val = load i64, ptr %arg.ptr2, align 8
  br label %join

join:
  %int.ptr = phi i64 [ %arg.ptr2.val, %if ], [ %arg.int.ptr, %else ]
  %ptr = int2ptr i64 %int.ptr to ptr
  %v = load i64, ptr %ptr, align 8
  ret i64 %v
}
Transformation seems to be correct! (syntactically equal)

-- 231. InstCombinePass

----------------------------------------
define i64 @inttoptr_of_phi(i1 %c, ptr %arg.ptr, ptr %arg.ptr2) {
entry:
  br i1 %c, label %if, label %else

else:
  %arg.int.ptr = ptrtoint ptr %arg.ptr to i64
  br label %join

if:
  %arg.ptr2.val = load i64, ptr %arg.ptr2, align 8
  br label %join

join:
  %int.ptr = phi i64 [ %arg.ptr2.val, %if ], [ %arg.int.ptr, %else ]
  %ptr = int2ptr i64 %int.ptr to ptr
  %v = load i64, ptr %ptr, align 8
  ret i64 %v
}
=>
define i64 @inttoptr_of_phi(i1 %c, ptr %arg.ptr, ptr %arg.ptr2) {
entry:
  br i1 %c, label %if, label %else

else:
  br label %join

if:
  %arg.ptr2.val = load i64, ptr %arg.ptr2, align 8
  %arg.ptr2.val.ptr = int2ptr i64 %arg.ptr2.val to ptr
  br label %join

join:
  %int.ptr.ptr = phi ptr [ %arg.ptr2.val.ptr, %if ], [ %arg.ptr, %else ]
  %v = load i64, ptr %int.ptr.ptr, align 8
  ret i64 %v
}
Transformation doesn't verify! (unsound)
ERROR: Source is more defined than target

Example:
i1 %c = #x0 (0)
ptr %arg.ptr = null
ptr %arg.ptr2 = poison

Source:
  >> Jump to %else
i64 %arg.int.ptr = #x0000000000000000 (0)
  >> Jump to %join
i64 %int.ptr = #x0000000000000000 (0)
ptr %ptr = 0x0
i64 %v = poison

SOURCE MEMORY STATE
===================
NON-LOCAL BLOCKS:
Block 0 >	size: 0	align: 8	alloc type: 0	alive: false	address: 0
Block 1 >	size: 1	align: 1	alloc type: 0	alive: true	address: 2
Block 2 >	size: 1	align: 1	alloc type: 0	alive: true	address: 6
Block 3 >	size: 9	align: 8	alloc type: 0	alive: true	address: 0

Target:
  >> Jump to %else
  >> Jump to %join
ptr %int.ptr.ptr = null
i64 %v = UB triggered!


Pass: InstCombinePass
Command line: '/home/nlopes/llvm/build/bin/opt' '-load=/home/nlopes/alive2/build/tv/tv.so' '-load-pass-plugin=/home/nlopes/alive2/build/tv/tv.so' '-tv-exit-on-error' '-passes=instcombine' '-S' '-tv-smt-to=20000' '-tv-report-dir=/home/nlopes/alive2/build/logs' '-tv-smt-stats'
Wrote bitcode to: "/home/nlopes/alive2/build/logs/in_SXegmUDL_xSUx.bc"


------------------- SMT STATS -------------------
Num queries: 273
Num invalid: 0
Num skips:   0
Num trivial: 166 (37.8%)
Num timeout: 7 (2.6%)
Num errors:  0 (0.0%)
Num SAT:     144 (52.7%)
Num UNSAT:   122 (44.7%)
Alive2: Transform doesn't verify; aborting!

stderr:

RUN: at line 2: /home/nlopes/alive2/build/opt-alive.sh < /bitbucket/nlopes/llvm/llvm/test/Transforms/InstCombine/phi.ll -passes=instcombine -S | /bitbucket/nlopes/llvm/build/bin/FileCheck /bitbucket/nlopes/llvm/llvm/test/Transforms/InstCombine/phi.ll
+ /home/nlopes/alive2/build/opt-alive.sh -passes=instcombine -S
+ /bitbucket/nlopes/llvm/build/bin/FileCheck /bitbucket/nlopes/llvm/llvm/test/Transforms/InstCombine/phi.ll

FileCheck error: '<stdin>' is empty.
FileCheck command line:  /bitbucket/nlopes/llvm/build/bin/FileCheck /bitbucket/nlopes/llvm/llvm/test/Transforms/InstCombine/phi.ll

 

<-- Back