Test Failure: Transforms/InstCombine/select-cmp-cttz-ctlz.ll

Test source: git

Log:

Source: <stdin>
-- 1. ModuleToFunctionPassAdaptor
-- 1. PassManager<Function> : Skipping NOP
-- 2. InstCombinePass

----------------------------------------
define i16 @test1(i16 %x) {
#0:
  %ct = ctlz i16 %x, 1
  %tobool = icmp ne i16 %x, 0
  %cond = select i1 %tobool, i16 %ct, i16 16
  ret i16 %cond
}
Transformation seems to be correct! (syntactically equal)

-- 3. InstCombinePass

----------------------------------------
define i16 @test1(i16 %x) {
#0:
  %ct = ctlz i16 %x, 1
  %tobool = icmp ne i16 %x, 0
  %cond = select i1 %tobool, i16 %ct, i16 16
  ret i16 %cond
}
=>
define i16 @test1(i16 %x) {
#0:
  %ct = ctlz i16 %x, 0
  ret i16 %ct
}
Transformation seems to be correct!

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

----------------------------------------
define i32 @test2(i32 %x) {
#0:
  %ct = ctlz i32 %x, 1
  %tobool = icmp ne i32 %x, 0
  %cond = select i1 %tobool, i32 %ct, i32 32
  ret i32 %cond
}
Transformation seems to be correct! (syntactically equal)

-- 7. InstCombinePass

----------------------------------------
define i32 @test2(i32 %x) {
#0:
  %ct = ctlz i32 %x, 1
  %tobool = icmp ne i32 %x, 0
  %cond = select i1 %tobool, i32 %ct, i32 32
  ret i32 %cond
}
=>
define i32 @test2(i32 %x) {
#0:
  %ct = ctlz i32 %x, 0
  ret i32 %ct
}
Transformation seems to be correct!

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

----------------------------------------
define i64 @test3(i64 %x) {
#0:
  %ct = ctlz i64 %x, 1
  %tobool = icmp ne i64 %x, 0
  %cond = select i1 %tobool, i64 %ct, i64 64
  ret i64 %cond
}
Transformation seems to be correct! (syntactically equal)

-- 11. InstCombinePass

----------------------------------------
define i64 @test3(i64 %x) {
#0:
  %ct = ctlz i64 %x, 1
  %tobool = icmp ne i64 %x, 0
  %cond = select i1 %tobool, i64 %ct, i64 64
  ret i64 %cond
}
=>
define i64 @test3(i64 %x) {
#0:
  %ct = ctlz i64 %x, 0
  ret i64 %ct
}
Transformation seems to be correct!

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

----------------------------------------
define i16 @test4(i16 %x) {
#0:
  %ct = ctlz i16 %x, 1
  %tobool = icmp eq i16 %x, 0
  %cond = select i1 %tobool, i16 16, i16 %ct
  ret i16 %cond
}
Transformation seems to be correct! (syntactically equal)

-- 15. InstCombinePass

----------------------------------------
define i16 @test4(i16 %x) {
#0:
  %ct = ctlz i16 %x, 1
  %tobool = icmp eq i16 %x, 0
  %cond = select i1 %tobool, i16 16, i16 %ct
  ret i16 %cond
}
=>
define i16 @test4(i16 %x) {
#0:
  %ct = ctlz i16 %x, 0
  ret i16 %ct
}
Transformation seems to be correct!

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

----------------------------------------
define i16 @test4_with_range(i16 %x) {
#0:
  %ct = ctlz i16 %x, 1
  %tobool = icmp eq i16 %x, 0
  %cond = select i1 %tobool, i16 16, i16 %ct
  ret i16 %cond
}
Transformation seems to be correct! (syntactically equal)

-- 19. InstCombinePass

----------------------------------------
define i16 @test4_with_range(i16 %x) {
#0:
  %ct = ctlz i16 %x, 1
  %tobool = icmp eq i16 %x, 0
  %cond = select i1 %tobool, i16 16, i16 %ct
  ret i16 %cond
}
=>
define i16 @test4_with_range(i16 %x) {
#0:
  %ct = ctlz i16 %x, 0
  ret i16 %ct
}
Transformation seems to be correct!

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

----------------------------------------
define i32 @test5(i32 %x) {
#0:
  %ct = ctlz i32 %x, 1
  %tobool = icmp eq i32 %x, 0
  %cond = select i1 %tobool, i32 32, i32 %ct
  ret i32 %cond
}
Transformation seems to be correct! (syntactically equal)

-- 23. InstCombinePass

----------------------------------------
define i32 @test5(i32 %x) {
#0:
  %ct = ctlz i32 %x, 1
  %tobool = icmp eq i32 %x, 0
  %cond = select i1 %tobool, i32 32, i32 %ct
  ret i32 %cond
}
=>
define i32 @test5(i32 %x) {
#0:
  %ct = ctlz i32 %x, 0
  ret i32 %ct
}
Transformation seems to be correct!

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

----------------------------------------
define i64 @test6(i64 %x) {
#0:
  %ct = ctlz i64 %x, 1
  %tobool = icmp eq i64 %x, 0
  %cond = select i1 %tobool, i64 64, i64 %ct
  ret i64 %cond
}
Transformation seems to be correct! (syntactically equal)

-- 27. InstCombinePass

----------------------------------------
define i64 @test6(i64 %x) {
#0:
  %ct = ctlz i64 %x, 1
  %tobool = icmp eq i64 %x, 0
  %cond = select i1 %tobool, i64 64, i64 %ct
  ret i64 %cond
}
=>
define i64 @test6(i64 %x) {
#0:
  %ct = ctlz i64 %x, 0
  ret i64 %ct
}
Transformation seems to be correct!

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

----------------------------------------
define i16 @test1b(i16 %x) {
#0:
  %ct = cttz i16 %x, 1
  %tobool = icmp ne i16 %x, 0
  %cond = select i1 %tobool, i16 %ct, i16 16
  ret i16 %cond
}
Transformation seems to be correct! (syntactically equal)

-- 31. InstCombinePass

----------------------------------------
define i16 @test1b(i16 %x) {
#0:
  %ct = cttz i16 %x, 1
  %tobool = icmp ne i16 %x, 0
  %cond = select i1 %tobool, i16 %ct, i16 16
  ret i16 %cond
}
=>
define i16 @test1b(i16 %x) {
#0:
  %ct = cttz i16 %x, 0
  ret i16 %ct
}
Transformation seems to be correct!

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

----------------------------------------
define i32 @test2b(i32 %x) {
#0:
  %ct = cttz i32 %x, 1
  %tobool = icmp ne i32 %x, 0
  %cond = select i1 %tobool, i32 %ct, i32 32
  ret i32 %cond
}
Transformation seems to be correct! (syntactically equal)

-- 35. InstCombinePass

----------------------------------------
define i32 @test2b(i32 %x) {
#0:
  %ct = cttz i32 %x, 1
  %tobool = icmp ne i32 %x, 0
  %cond = select i1 %tobool, i32 %ct, i32 32
  ret i32 %cond
}
=>
define i32 @test2b(i32 %x) {
#0:
  %ct = cttz i32 %x, 0
  ret i32 %ct
}
Transformation seems to be correct!

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

----------------------------------------
define i64 @test3b(i64 %x) {
#0:
  %ct = cttz i64 %x, 1
  %tobool = icmp ne i64 %x, 0
  %cond = select i1 %tobool, i64 %ct, i64 64
  ret i64 %cond
}
Transformation seems to be correct! (syntactically equal)

-- 39. InstCombinePass

----------------------------------------
define i64 @test3b(i64 %x) {
#0:
  %ct = cttz i64 %x, 1
  %tobool = icmp ne i64 %x, 0
  %cond = select i1 %tobool, i64 %ct, i64 64
  ret i64 %cond
}
=>
define i64 @test3b(i64 %x) {
#0:
  %ct = cttz i64 %x, 0
  ret i64 %ct
}
Transformation seems to be correct!

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

----------------------------------------
define i16 @test4b(i16 %x) {
#0:
  %ct = cttz i16 %x, 1
  %tobool = icmp eq i16 %x, 0
  %cond = select i1 %tobool, i16 16, i16 %ct
  ret i16 %cond
}
Transformation seems to be correct! (syntactically equal)

-- 43. InstCombinePass

----------------------------------------
define i16 @test4b(i16 %x) {
#0:
  %ct = cttz i16 %x, 1
  %tobool = icmp eq i16 %x, 0
  %cond = select i1 %tobool, i16 16, i16 %ct
  ret i16 %cond
}
=>
define i16 @test4b(i16 %x) {
#0:
  %ct = cttz i16 %x, 0
  ret i16 %ct
}
Transformation seems to be correct!

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

----------------------------------------
define i16 @test4b_with_range(i16 %x) {
#0:
  %ct = cttz i16 %x, 1
  %tobool = icmp eq i16 %x, 0
  %cond = select i1 %tobool, i16 16, i16 %ct
  ret i16 %cond
}
Transformation seems to be correct! (syntactically equal)

-- 47. InstCombinePass

----------------------------------------
define i16 @test4b_with_range(i16 %x) {
#0:
  %ct = cttz i16 %x, 1
  %tobool = icmp eq i16 %x, 0
  %cond = select i1 %tobool, i16 16, i16 %ct
  ret i16 %cond
}
=>
define i16 @test4b_with_range(i16 %x) {
#0:
  %ct = cttz i16 %x, 0
  ret i16 %ct
}
Transformation seems to be correct!

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

----------------------------------------
define i32 @test5b(i32 %x) {
entry:
  %ct = cttz i32 %x, 1
  %tobool = icmp eq i32 %x, 0
  %cond = select i1 %tobool, i32 32, i32 %ct
  ret i32 %cond
}
Transformation seems to be correct! (syntactically equal)

-- 51. InstCombinePass

----------------------------------------
define i32 @test5b(i32 %x) {
entry:
  %ct = cttz i32 %x, 1
  %tobool = icmp eq i32 %x, 0
  %cond = select i1 %tobool, i32 32, i32 %ct
  ret i32 %cond
}
=>
define i32 @test5b(i32 %x) {
entry:
  %ct = cttz i32 %x, 0
  ret i32 %ct
}
Transformation seems to be correct!

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

----------------------------------------
define i64 @test6b(i64 %x) {
#0:
  %ct = cttz i64 %x, 1
  %tobool = icmp eq i64 %x, 0
  %cond = select i1 %tobool, i64 64, i64 %ct
  ret i64 %cond
}
Transformation seems to be correct! (syntactically equal)

-- 55. InstCombinePass

----------------------------------------
define i64 @test6b(i64 %x) {
#0:
  %ct = cttz i64 %x, 1
  %tobool = icmp eq i64 %x, 0
  %cond = select i1 %tobool, i64 64, i64 %ct
  ret i64 %cond
}
=>
define i64 @test6b(i64 %x) {
#0:
  %ct = cttz i64 %x, 0
  ret i64 %ct
}
Transformation seems to be correct!

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

----------------------------------------
define i32 @test1c(i16 %x) {
#0:
  %ct = cttz i16 %x, 1
  %cast2 = zext i16 %ct to i32
  %tobool = icmp ne i16 %x, 0
  %cond = select i1 %tobool, i32 %cast2, i32 16
  ret i32 %cond
}
Transformation seems to be correct! (syntactically equal)

-- 59. InstCombinePass

----------------------------------------
define i32 @test1c(i16 %x) {
#0:
  %ct = cttz i16 %x, 1
  %cast2 = zext i16 %ct to i32
  %tobool = icmp ne i16 %x, 0
  %cond = select i1 %tobool, i32 %cast2, i32 16
  ret i32 %cond
}
=>
define i32 @test1c(i16 %x) {
#0:
  %ct = cttz i16 %x, 0
  %cast2 = zext nneg i16 %ct to i32
  ret i32 %cast2
}
Transformation seems to be correct!

-- 60. PassManager<Function> : Skipping NOP
-- 61. PassManager<Function> : Skipping NOP
-- 62. InstCombinePass

----------------------------------------
define i64 @test2c(i16 %x) {
#0:
  %ct = cttz i16 %x, 1
  %conv = zext i16 %ct to i64
  %tobool = icmp ne i16 %x, 0
  %cond = select i1 %tobool, i64 %conv, i64 16
  ret i64 %cond
}
Transformation seems to be correct! (syntactically equal)

-- 63. InstCombinePass

----------------------------------------
define i64 @test2c(i16 %x) {
#0:
  %ct = cttz i16 %x, 1
  %conv = zext i16 %ct to i64
  %tobool = icmp ne i16 %x, 0
  %cond = select i1 %tobool, i64 %conv, i64 16
  ret i64 %cond
}
=>
define i64 @test2c(i16 %x) {
#0:
  %ct = cttz i16 %x, 0
  %conv = zext nneg i16 %ct to i64
  ret i64 %conv
}
Transformation seems to be correct!

-- 64. PassManager<Function> : Skipping NOP
-- 65. PassManager<Function> : Skipping NOP
-- 66. InstCombinePass

----------------------------------------
define i64 @test3c(i32 %x) {
#0:
  %ct = cttz i32 %x, 1
  %conv = zext i32 %ct to i64
  %tobool = icmp ne i32 %x, 0
  %cond = select i1 %tobool, i64 %conv, i64 32
  ret i64 %cond
}
Transformation seems to be correct! (syntactically equal)

-- 67. InstCombinePass

----------------------------------------
define i64 @test3c(i32 %x) {
#0:
  %ct = cttz i32 %x, 1
  %conv = zext i32 %ct to i64
  %tobool = icmp ne i32 %x, 0
  %cond = select i1 %tobool, i64 %conv, i64 32
  ret i64 %cond
}
=>
define i64 @test3c(i32 %x) {
#0:
  %ct = cttz i32 %x, 0
  %conv = zext nneg i32 %ct to i64
  ret i64 %conv
}
Transformation seems to be correct!

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

----------------------------------------
define i32 @test4c(i16 %x) {
#0:
  %ct = ctlz i16 %x, 1
  %cast = zext i16 %ct to i32
  %tobool = icmp ne i16 %x, 0
  %cond = select i1 %tobool, i32 %cast, i32 16
  ret i32 %cond
}
Transformation seems to be correct! (syntactically equal)

-- 71. InstCombinePass

----------------------------------------
define i32 @test4c(i16 %x) {
#0:
  %ct = ctlz i16 %x, 1
  %cast = zext i16 %ct to i32
  %tobool = icmp ne i16 %x, 0
  %cond = select i1 %tobool, i32 %cast, i32 16
  ret i32 %cond
}
=>
define i32 @test4c(i16 %x) {
#0:
  %ct = ctlz i16 %x, 0
  %cast = zext nneg i16 %ct to i32
  ret i32 %cast
}
Transformation seems to be correct!

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

----------------------------------------
define i64 @test5c(i16 %x) {
#0:
  %ct = ctlz i16 %x, 1
  %cast = zext i16 %ct to i64
  %tobool = icmp ne i16 %x, 0
  %cond = select i1 %tobool, i64 %cast, i64 16
  ret i64 %cond
}
Transformation seems to be correct! (syntactically equal)

-- 75. InstCombinePass

----------------------------------------
define i64 @test5c(i16 %x) {
#0:
  %ct = ctlz i16 %x, 1
  %cast = zext i16 %ct to i64
  %tobool = icmp ne i16 %x, 0
  %cond = select i1 %tobool, i64 %cast, i64 16
  ret i64 %cond
}
=>
define i64 @test5c(i16 %x) {
#0:
  %ct = ctlz i16 %x, 0
  %cast = zext nneg i16 %ct to i64
  ret i64 %cast
}
Transformation seems to be correct!

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

----------------------------------------
define i64 @test6c(i32 %x) {
#0:
  %ct = ctlz i32 %x, 1
  %cast = zext i32 %ct to i64
  %tobool = icmp ne i32 %x, 0
  %cond = select i1 %tobool, i64 %cast, i64 32
  ret i64 %cond
}
Transformation seems to be correct! (syntactically equal)

-- 79. InstCombinePass

----------------------------------------
define i64 @test6c(i32 %x) {
#0:
  %ct = ctlz i32 %x, 1
  %cast = zext i32 %ct to i64
  %tobool = icmp ne i32 %x, 0
  %cond = select i1 %tobool, i64 %cast, i64 32
  ret i64 %cond
}
=>
define i64 @test6c(i32 %x) {
#0:
  %ct = ctlz i32 %x, 0
  %cast = zext nneg i32 %ct to i64
  ret i64 %cast
}
Transformation seems to be correct!

-- 80. PassManager<Function> : Skipping NOP
-- 81. PassManager<Function> : Skipping NOP
-- 82. InstCombinePass

----------------------------------------
define i16 @test1d(i64 %x) {
#0:
  %ct = cttz i64 %x, 1
  %conv = trunc i64 %ct to i16
  %tobool = icmp ne i64 %x, 0
  %cond = select i1 %tobool, i16 %conv, i16 64
  ret i16 %cond
}
Transformation seems to be correct! (syntactically equal)

-- 83. InstCombinePass

----------------------------------------
define i16 @test1d(i64 %x) {
#0:
  %ct = cttz i64 %x, 1
  %conv = trunc i64 %ct to i16
  %tobool = icmp ne i64 %x, 0
  %cond = select i1 %tobool, i16 %conv, i16 64
  ret i16 %cond
}
=>
define i16 @test1d(i64 %x) {
#0:
  %ct = cttz i64 %x, 0
  %conv = trunc nsw nuw i64 %ct to i16
  ret i16 %conv
}
Transformation seems to be correct!

-- 84. PassManager<Function> : Skipping NOP
-- 85. PassManager<Function> : Skipping NOP
-- 86. InstCombinePass

----------------------------------------
define i32 @test2d(i64 %x) {
#0:
  %ct = cttz i64 %x, 1
  %cast = trunc i64 %ct to i32
  %tobool = icmp ne i64 %x, 0
  %cond = select i1 %tobool, i32 %cast, i32 64
  ret i32 %cond
}
Transformation seems to be correct! (syntactically equal)

-- 87. InstCombinePass

----------------------------------------
define i32 @test2d(i64 %x) {
#0:
  %ct = cttz i64 %x, 1
  %cast = trunc i64 %ct to i32
  %tobool = icmp ne i64 %x, 0
  %cond = select i1 %tobool, i32 %cast, i32 64
  ret i32 %cond
}
=>
define i32 @test2d(i64 %x) {
#0:
  %ct = cttz i64 %x, 0
  %cast = trunc nsw nuw i64 %ct to i32
  ret i32 %cast
}
Transformation seems to be correct!

-- 88. PassManager<Function> : Skipping NOP
-- 89. PassManager<Function> : Skipping NOP
-- 90. InstCombinePass

----------------------------------------
define i16 @test3d(i32 %x) {
#0:
  %ct = cttz i32 %x, 1
  %cast = trunc i32 %ct to i16
  %tobool = icmp ne i32 %x, 0
  %cond = select i1 %tobool, i16 %cast, i16 32
  ret i16 %cond
}
Transformation seems to be correct! (syntactically equal)

-- 91. InstCombinePass

----------------------------------------
define i16 @test3d(i32 %x) {
#0:
  %ct = cttz i32 %x, 1
  %cast = trunc i32 %ct to i16
  %tobool = icmp ne i32 %x, 0
  %cond = select i1 %tobool, i16 %cast, i16 32
  ret i16 %cond
}
=>
define i16 @test3d(i32 %x) {
#0:
  %ct = cttz i32 %x, 0
  %cast = trunc nsw nuw i32 %ct to i16
  ret i16 %cast
}
Transformation seems to be correct!

-- 92. PassManager<Function> : Skipping NOP
-- 93. PassManager<Function> : Skipping NOP
-- 94. InstCombinePass

----------------------------------------
define i16 @test4d(i64 %x) {
#0:
  %ct = ctlz i64 %x, 1
  %cast = trunc i64 %ct to i16
  %tobool = icmp ne i64 %x, 0
  %cond = select i1 %tobool, i16 %cast, i16 64
  ret i16 %cond
}
Transformation seems to be correct! (syntactically equal)

-- 95. InstCombinePass

----------------------------------------
define i16 @test4d(i64 %x) {
#0:
  %ct = ctlz i64 %x, 1
  %cast = trunc i64 %ct to i16
  %tobool = icmp ne i64 %x, 0
  %cond = select i1 %tobool, i16 %cast, i16 64
  ret i16 %cond
}
=>
define i16 @test4d(i64 %x) {
#0:
  %ct = ctlz i64 %x, 0
  %cast = trunc nsw nuw i64 %ct to i16
  ret i16 %cast
}
Transformation seems to be correct!

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

----------------------------------------
define i32 @test5d(i64 %x) {
#0:
  %ct = ctlz i64 %x, 1
  %cast = trunc i64 %ct to i32
  %tobool = icmp ne i64 %x, 0
  %cond = select i1 %tobool, i32 %cast, i32 64
  ret i32 %cond
}
Transformation seems to be correct! (syntactically equal)

-- 99. InstCombinePass

----------------------------------------
define i32 @test5d(i64 %x) {
#0:
  %ct = ctlz i64 %x, 1
  %cast = trunc i64 %ct to i32
  %tobool = icmp ne i64 %x, 0
  %cond = select i1 %tobool, i32 %cast, i32 64
  ret i32 %cond
}
=>
define i32 @test5d(i64 %x) {
#0:
  %ct = ctlz i64 %x, 0
  %cast = trunc nsw nuw i64 %ct to i32
  ret i32 %cast
}
Transformation seems to be correct!

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

----------------------------------------
define i32 @not_op_ctlz(i64 %x) {
#0:
  %n = xor i64 %x, -1
  %ct = ctlz i64 %n, 1
  %cast = trunc i64 %ct to i32
  %tobool = icmp eq i64 %x, -1
  %r = select i1 %tobool, i32 64, i32 %cast
  ret i32 %r
}
Transformation seems to be correct! (syntactically equal)

-- 103. InstCombinePass

----------------------------------------
define i32 @not_op_ctlz(i64 %x) {
#0:
  %n = xor i64 %x, -1
  %ct = ctlz i64 %n, 1
  %cast = trunc i64 %ct to i32
  %tobool = icmp eq i64 %x, -1
  %r = select i1 %tobool, i32 64, i32 %cast
  ret i32 %r
}
=>
define i32 @not_op_ctlz(i64 %x) {
#0:
  %n = xor i64 %x, -1
  %ct = ctlz i64 %n, 0
  %cast = trunc nsw nuw i64 %ct to i32
  ret i32 %cast
}
Transformation seems to be correct!

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

----------------------------------------
define i32 @not_op_cttz(i64 %x) {
#0:
  %n = xor i64 %x, -1
  %ct = cttz i64 %n, 1
  %cast = trunc i64 %ct to i32
  %tobool = icmp eq i64 %x, -1
  %r = select i1 %tobool, i32 64, i32 %cast
  ret i32 %r
}
Transformation seems to be correct! (syntactically equal)

-- 107. InstCombinePass

----------------------------------------
define i32 @not_op_cttz(i64 %x) {
#0:
  %n = xor i64 %x, -1
  %ct = cttz i64 %n, 1
  %cast = trunc i64 %ct to i32
  %tobool = icmp eq i64 %x, -1
  %r = select i1 %tobool, i32 64, i32 %cast
  ret i32 %r
}
=>
define i32 @not_op_cttz(i64 %x) {
#0:
  %n = xor i64 %x, -1
  %ct = cttz i64 %n, 0
  %cast = trunc nsw nuw i64 %ct to i32
  ret i32 %cast
}
Transformation seems to be correct!

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

----------------------------------------
define i32 @not_op_ctlz_wrong_xor_op1(i64 %x) {
#0:
  %n = xor i64 %x, -2
  %ct = ctlz i64 %n, 1
  %cast = trunc i64 %ct to i32
  %tobool = icmp eq i64 %x, -1
  %r = select i1 %tobool, i32 64, i32 %cast
  ret i32 %r
}
Transformation seems to be correct! (syntactically equal)

-- 111. InstCombinePass

----------------------------------------
define i32 @not_op_ctlz_wrong_xor_op1(i64 %x) {
#0:
  %n = xor i64 %x, -2
  %ct = ctlz i64 %n, 1
  %cast = trunc i64 %ct to i32
  %tobool = icmp eq i64 %x, -1
  %r = select i1 %tobool, i32 64, i32 %cast
  ret i32 %r
}
=>
define i32 @not_op_ctlz_wrong_xor_op1(i64 %x) {
#0:
  %n = xor i64 %x, -2
  %ct = ctlz i64 %n, 1
  %cast = trunc nsw nuw i64 %ct to i32
  %tobool = icmp eq i64 %x, -1
  %r = select i1 %tobool, i32 64, i32 %cast
  ret i32 %r
}
Transformation seems to be correct!

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

----------------------------------------
define i32 @not_op_ctlz_wrong_xor_op0(i64 %x, i64 %y) {
#0:
  %n = xor i64 %y, -1
  %ct = ctlz i64 %n, 1
  %cast = trunc i64 %ct to i32
  %tobool = icmp eq i64 %x, -1
  %r = select i1 %tobool, i32 64, i32 %cast
  ret i32 %r
}
Transformation seems to be correct! (syntactically equal)

-- 115. InstCombinePass

----------------------------------------
define i32 @not_op_ctlz_wrong_xor_op0(i64 %x, i64 %y) {
#0:
  %n = xor i64 %y, -1
  %ct = ctlz i64 %n, 1
  %cast = trunc i64 %ct to i32
  %tobool = icmp eq i64 %x, -1
  %r = select i1 %tobool, i32 64, i32 %cast
  ret i32 %r
}
=>
define i32 @not_op_ctlz_wrong_xor_op0(i64 %x, i64 %y) {
#0:
  %n = xor i64 %y, -1
  %ct = ctlz i64 %n, 1
  %cast = trunc nsw nuw i64 %ct to i32
  %tobool = icmp eq i64 %x, -1
  %r = select i1 %tobool, i32 64, i32 %cast
  ret i32 %r
}
Transformation seems to be correct!

-- 116. PassManager<Function> : Skipping NOP
-- 117. PassManager<Function> : Skipping NOP
-- 118. InstCombinePass

----------------------------------------
define i32 @not_op_cttz_wrong_cmp(i64 %x) {
#0:
  %n = xor i64 %x, -1
  %ct = cttz i64 %n, 1
  %cast = trunc i64 %ct to i32
  %tobool = icmp eq i64 %x, 0
  %r = select i1 %tobool, i32 64, i32 %cast
  ret i32 %r
}
Transformation seems to be correct! (syntactically equal)

-- 119. InstCombinePass

----------------------------------------
define i32 @not_op_cttz_wrong_cmp(i64 %x) {
#0:
  %n = xor i64 %x, -1
  %ct = cttz i64 %n, 1
  %cast = trunc i64 %ct to i32
  %tobool = icmp eq i64 %x, 0
  %r = select i1 %tobool, i32 64, i32 %cast
  ret i32 %r
}
=>
define i32 @not_op_cttz_wrong_cmp(i64 %x) {
#0:
  %n = xor i64 %x, -1
  %ct = cttz i64 %n, 1
  %cast = trunc nsw nuw i64 %ct to i32
  %tobool = icmp eq i64 %x, 0
  %r = select i1 %tobool, i32 64, i32 %cast
  ret i32 %r
}
Transformation seems to be correct!

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

----------------------------------------
define i16 @test6d(i32 %x) {
#0:
  %ct = ctlz i32 %x, 1
  %cast = trunc i32 %ct to i16
  %tobool = icmp ne i32 %x, 0
  %cond = select i1 %tobool, i16 %cast, i16 32
  ret i16 %cond
}
Transformation seems to be correct! (syntactically equal)

-- 123. InstCombinePass

----------------------------------------
define i16 @test6d(i32 %x) {
#0:
  %ct = ctlz i32 %x, 1
  %cast = trunc i32 %ct to i16
  %tobool = icmp ne i32 %x, 0
  %cond = select i1 %tobool, i16 %cast, i16 32
  ret i16 %cond
}
=>
define i16 @test6d(i32 %x) {
#0:
  %ct = ctlz i32 %x, 0
  %cast = trunc nsw nuw i32 %ct to i16
  ret i16 %cast
}
Transformation seems to be correct!

-- 124. PassManager<Function> : Skipping NOP
-- 125. PassManager<Function> : Skipping NOP
-- 126. InstCombinePass

----------------------------------------
define i64 @select_bug1(i32 %x) {
#0:
  %ct = cttz i32 %x, 0
  %conv = zext i32 %ct to i64
  %tobool = icmp ne i32 %x, 0
  %cond = select i1 %tobool, i64 %conv, i64 32
  ret i64 %cond
}
Transformation seems to be correct! (syntactically equal)

-- 127. InstCombinePass

----------------------------------------
define i64 @select_bug1(i32 %x) {
#0:
  %ct = cttz i32 %x, 0
  %conv = zext i32 %ct to i64
  %tobool = icmp ne i32 %x, 0
  %cond = select i1 %tobool, i64 %conv, i64 32
  ret i64 %cond
}
=>
define i64 @select_bug1(i32 %x) {
#0:
  %ct = cttz i32 %x, 0
  %conv = zext nneg i32 %ct to i64
  ret i64 %conv
}
Transformation seems to be correct!

-- 128. PassManager<Function> : Skipping NOP
-- 129. PassManager<Function> : Skipping NOP
-- 130. InstCombinePass

----------------------------------------
define i16 @select_bug2(i32 %x) {
#0:
  %ct = cttz i32 %x, 0
  %conv = trunc i32 %ct to i16
  %tobool = icmp ne i32 %x, 0
  %cond = select i1 %tobool, i16 %conv, i16 32
  ret i16 %cond
}
Transformation seems to be correct! (syntactically equal)

-- 131. InstCombinePass

----------------------------------------
define i16 @select_bug2(i32 %x) {
#0:
  %ct = cttz i32 %x, 0
  %conv = trunc i32 %ct to i16
  %tobool = icmp ne i32 %x, 0
  %cond = select i1 %tobool, i16 %conv, i16 32
  ret i16 %cond
}
=>
define i16 @select_bug2(i32 %x) {
#0:
  %ct = cttz i32 %x, 0
  %conv = trunc nsw nuw i32 %ct to i16
  ret i16 %conv
}
Transformation seems to be correct!

-- 132. PassManager<Function> : Skipping NOP
-- 133. PassManager<Function> : Skipping NOP
-- 134. InstCombinePass

----------------------------------------
define i128 @test7(i128 %x) {
#0:
  %ct = ctlz i128 %x, 1
  %tobool = icmp ne i128 %x, 0
  %cond = select i1 %tobool, i128 %ct, i128 128
  ret i128 %cond
}
Transformation seems to be correct! (syntactically equal)

-- 135. InstCombinePass

----------------------------------------
define i128 @test7(i128 %x) {
#0:
  %ct = ctlz i128 %x, 1
  %tobool = icmp ne i128 %x, 0
  %cond = select i1 %tobool, i128 %ct, i128 128
  ret i128 %cond
}
=>
define i128 @test7(i128 %x) {
#0:
  %ct = ctlz i128 %x, 0
  ret i128 %ct
}
Transformation seems to be correct!

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

----------------------------------------
define i128 @test8(i128 %x) {
#0:
  %ct = cttz i128 %x, 1
  %tobool = icmp ne i128 %x, 0
  %cond = select i1 %tobool, i128 %ct, i128 128
  ret i128 %cond
}
Transformation seems to be correct! (syntactically equal)

-- 139. InstCombinePass

----------------------------------------
define i128 @test8(i128 %x) {
#0:
  %ct = cttz i128 %x, 1
  %tobool = icmp ne i128 %x, 0
  %cond = select i1 %tobool, i128 %ct, i128 128
  ret i128 %cond
}
=>
define i128 @test8(i128 %x) {
#0:
  %ct = cttz i128 %x, 0
  ret i128 %ct
}
Transformation seems to be correct!

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

----------------------------------------
define i32 @test_ctlz_not_bw(i32 %x) {
#0:
  %ct = ctlz i32 %x, 0
  %cmp = icmp ne i32 %x, 0
  %res = select i1 %cmp, i32 %ct, i32 123
  ret i32 %res
}
Transformation seems to be correct! (syntactically equal)

-- 143. InstCombinePass

----------------------------------------
define i32 @test_ctlz_not_bw(i32 %x) {
#0:
  %ct = ctlz i32 %x, 0
  %cmp = icmp ne i32 %x, 0
  %res = select i1 %cmp, i32 %ct, i32 123
  ret i32 %res
}
=>
define i32 @test_ctlz_not_bw(i32 %x) {
#0:
  %ct = ctlz i32 %x, 1
  %cmp.not = icmp eq i32 %x, 0
  %res = select i1 %cmp.not, i32 123, i32 %ct
  ret i32 %res
}
Transformation doesn't verify! (unsound)
ERROR: Target is more poisonous than source

Example:
i32 %x = undef

Source:
i32 %ct = #x00000020 (32)	[based on undef value]
i1 %cmp = #x0 (0)	[based on undef value]
i32 %res = #x0000007b (123)

Target:
i32 %ct = poison
i1 %cmp.not = #x0 (0)
i32 %res = poison
Source value: #x0000007b (123)
Target value: poison

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_pqEFog0W_vkdV.bc"


------------------- SMT STATS -------------------
Num queries: 184
Num invalid: 0
Num skips:   0
Num trivial: 113 (38.0%)
Num timeout: 0 (0.0%)
Num errors:  0 (0.0%)
Num SAT:     77 (41.8%)
Num UNSAT:   107 (58.2%)
Alive2: Transform doesn't verify; aborting!

stderr:

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

FileCheck error: '<stdin>' is empty.
FileCheck command line:  /bitbucket/nlopes/llvm/build/bin/FileCheck /bitbucket/nlopes/llvm/llvm/test/Transforms/InstCombine/select-cmp-cttz-ctlz.ll

 

NOTE: This test would pass if undef didn't exist!

 

<-- Back