Test source: git
Comments: LLVM bug: incorrect propagation of pointer equality
Source: <stdin> -- 1. ModuleToFunctionPassAdaptor ERROR: Unsupported attribute: noalias -- 1. PassManager<Function> : Skipping NOP -- 2. GVNPass ---------------------------------------- @a = global 4 bytes, align 4 define i32 @test1() { %entry: %0 = load i32, ptr @a, align 4 %1 = icmp eq i32 %0, 4 br i1 %1, label %bb, label %bb1 %bb1: %2 = load i32, ptr @a, align 4 %3 = icmp eq i32 %2, 5 br i1 %3, label %bb2, label %bb3 %bb2: br label %bb8 %bb3: %4 = load i32, ptr @a, align 4 %5 = icmp eq i32 %4, 4 br i1 %5, label %bb4, label %bb5 %bb4: %6 = load i32, ptr @a, align 4 %7 = add i32 %6, 5 br label %bb8 %bb5: %8 = load i32, ptr @a, align 4 %9 = icmp eq i32 %8, 5 br i1 %9, label %bb6, label %bb7 %bb6: %10 = load i32, ptr @a, align 4 %11 = add i32 %10, 4 br label %bb8 %bb7: %12 = load i32, ptr @a, align 4 br label %bb8 %bb: br label %bb8 %bb8: %.0 = phi i32 [ %12, %bb7 ], [ %11, %bb6 ], [ %7, %bb4 ], [ 4, %bb2 ], [ 5, %bb ] br label %return %return: ret i32 %.0 } Transformation seems to be correct! (syntactically equal) -- 3. GVNPass ---------------------------------------- @a = global 4 bytes, align 4 define i32 @test1() { %entry: %0 = load i32, ptr @a, align 4 %1 = icmp eq i32 %0, 4 br i1 %1, label %bb, label %bb1 %bb1: %2 = load i32, ptr @a, align 4 %3 = icmp eq i32 %2, 5 br i1 %3, label %bb2, label %bb3 %bb2: br label %bb8 %bb3: %4 = load i32, ptr @a, align 4 %5 = icmp eq i32 %4, 4 br i1 %5, label %bb4, label %bb5 %bb4: %6 = load i32, ptr @a, align 4 %7 = add i32 %6, 5 br label %bb8 %bb5: %8 = load i32, ptr @a, align 4 %9 = icmp eq i32 %8, 5 br i1 %9, label %bb6, label %bb7 %bb6: %10 = load i32, ptr @a, align 4 %11 = add i32 %10, 4 br label %bb8 %bb7: %12 = load i32, ptr @a, align 4 br label %bb8 %bb: br label %bb8 %bb8: %.0 = phi i32 [ %12, %bb7 ], [ %11, %bb6 ], [ %7, %bb4 ], [ 4, %bb2 ], [ 5, %bb ] br label %return %return: ret i32 %.0 } => @a = global 4 bytes, align 4 define i32 @test1() { %entry: %0 = load i32, ptr @a, align 4 %1 = icmp eq i32 %0, 4 br i1 %1, label %bb, label %bb1 %bb1: %2 = icmp eq i32 %0, 5 br i1 %2, label %bb2, label %bb3 %bb2: br label %bb8 %bb3: br i1 0, label %bb4, label %bb5 %bb4: %3 = load i32, ptr @a, align 4 %4 = add i32 %3, 5 br label %bb8 %bb5: br i1 0, label %bb6, label %bb7 %bb6: %5 = load i32, ptr @a, align 4 %6 = add i32 %5, 4 br label %bb8 %bb7: br label %bb8 %bb: br label %bb8 %bb8: %.0 = phi i32 [ %0, %bb7 ], [ poison, %bb6 ], [ poison, %bb4 ], [ 4, %bb2 ], [ 5, %bb ] ret i32 %.0 } Transformation seems to be correct! -- 4. PassManager<Function> : Skipping NOP -- 5. PassManager<Function> : Skipping NOP -- 6. GVNPass ---------------------------------------- define void @test3(i32 %x, i32 %y) { %0: %xz = icmp eq i32 %x, 0 %yz = icmp eq i32 %y, 0 %z = and i1 %xz, %yz br i1 %z, label %both_zero, label %nope %nope: call void @foo(i1 %z) ret void %both_zero: call void @foo(i1 %xz) call void @foo(i1 %yz) call void @bar(i32 %x) call void @bar(i32 %y) ret void } Transformation seems to be correct! (syntactically equal) -- 7. GVNPass ---------------------------------------- define void @test3(i32 %x, i32 %y) { %0: %xz = icmp eq i32 %x, 0 %yz = icmp eq i32 %y, 0 %z = and i1 %xz, %yz br i1 %z, label %both_zero, label %nope %nope: call void @foo(i1 %z) ret void %both_zero: call void @foo(i1 %xz) call void @foo(i1 %yz) call void @bar(i32 %x) call void @bar(i32 %y) ret void } => define void @test3(i32 %x, i32 %y) { %0: %xz = icmp eq i32 %x, 0 %yz = icmp eq i32 %y, 0 %z = and i1 %xz, %yz br i1 %z, label %both_zero, label %nope %nope: call void @foo(i1 0) ret void %both_zero: call void @foo(i1 1) call void @foo(i1 1) call void @bar(i32 0) call void @bar(i32 0) ret void } Transformation seems to be correct! -- 8. PassManager<Function> : Skipping NOP -- 9. PassManager<Function> : Skipping NOP -- 10. GVNPass ---------------------------------------- define void @test3_select(i32 %x, i32 %y) { %0: %xz = icmp eq i32 %x, 0 %yz = icmp eq i32 %y, 0 %z = select i1 %xz, i1 %yz, i1 0 br i1 %z, label %both_zero, label %nope %nope: call void @foo(i1 %z) ret void %both_zero: call void @foo(i1 %xz) call void @foo(i1 %yz) call void @bar(i32 %x) call void @bar(i32 %y) ret void } Transformation seems to be correct! (syntactically equal) -- 11. GVNPass ---------------------------------------- define void @test3_select(i32 %x, i32 %y) { %0: %xz = icmp eq i32 %x, 0 %yz = icmp eq i32 %y, 0 %z = select i1 %xz, i1 %yz, i1 0 br i1 %z, label %both_zero, label %nope %nope: call void @foo(i1 %z) ret void %both_zero: call void @foo(i1 %xz) call void @foo(i1 %yz) call void @bar(i32 %x) call void @bar(i32 %y) ret void } => define void @test3_select(i32 %x, i32 %y) { %0: %xz = icmp eq i32 %x, 0 %yz = icmp eq i32 %y, 0 %z = select i1 %xz, i1 %yz, i1 0 br i1 %z, label %both_zero, label %nope %nope: call void @foo(i1 0) ret void %both_zero: call void @foo(i1 1) call void @foo(i1 1) call void @bar(i32 0) call void @bar(i32 0) ret void } Transformation seems to be correct! -- 12. PassManager<Function> : Skipping NOP -- 13. PassManager<Function> : Skipping NOP -- 14. GVNPass ---------------------------------------- define void @test3_or(i32 %x, i32 %y) { %0: %xz = icmp ne i32 %x, 0 %yz = icmp ne i32 %y, 0 %z = or i1 %xz, %yz br i1 %z, label %nope, label %both_zero %both_zero: call void @foo(i1 %xz) call void @foo(i1 %yz) call void @bar(i32 %x) call void @bar(i32 %y) ret void %nope: call void @foo(i1 %z) ret void } Transformation seems to be correct! (syntactically equal) -- 15. GVNPass ---------------------------------------- define void @test3_or(i32 %x, i32 %y) { %0: %xz = icmp ne i32 %x, 0 %yz = icmp ne i32 %y, 0 %z = or i1 %xz, %yz br i1 %z, label %nope, label %both_zero %both_zero: call void @foo(i1 %xz) call void @foo(i1 %yz) call void @bar(i32 %x) call void @bar(i32 %y) ret void %nope: call void @foo(i1 %z) ret void } => define void @test3_or(i32 %x, i32 %y) { %0: %xz = icmp ne i32 %x, 0 %yz = icmp ne i32 %y, 0 %z = or i1 %xz, %yz br i1 %z, label %nope, label %both_zero %both_zero: call void @foo(i1 0) call void @foo(i1 0) call void @bar(i32 0) call void @bar(i32 0) ret void %nope: call void @foo(i1 1) ret void } Transformation seems to be correct! -- 16. PassManager<Function> : Skipping NOP -- 17. PassManager<Function> : Skipping NOP -- 18. GVNPass ---------------------------------------- define void @test3_or_select(i32 %x, i32 %y) { %0: %xz = icmp ne i32 %x, 0 %yz = icmp ne i32 %y, 0 %z = select i1 %xz, i1 1, i1 %yz br i1 %z, label %nope, label %both_zero %both_zero: call void @foo(i1 %xz) call void @foo(i1 %yz) call void @bar(i32 %x) call void @bar(i32 %y) ret void %nope: call void @foo(i1 %z) ret void } Transformation seems to be correct! (syntactically equal) -- 19. GVNPass ---------------------------------------- define void @test3_or_select(i32 %x, i32 %y) { %0: %xz = icmp ne i32 %x, 0 %yz = icmp ne i32 %y, 0 %z = select i1 %xz, i1 1, i1 %yz br i1 %z, label %nope, label %both_zero %both_zero: call void @foo(i1 %xz) call void @foo(i1 %yz) call void @bar(i32 %x) call void @bar(i32 %y) ret void %nope: call void @foo(i1 %z) ret void } => define void @test3_or_select(i32 %x, i32 %y) { %0: %xz = icmp ne i32 %x, 0 %yz = icmp ne i32 %y, 0 %z = select i1 %xz, i1 1, i1 %yz br i1 %z, label %nope, label %both_zero %both_zero: call void @foo(i1 0) call void @foo(i1 0) call void @bar(i32 0) call void @bar(i32 0) ret void %nope: call void @foo(i1 1) ret void } Transformation seems to be correct! -- 20. PassManager<Function> : Skipping NOP -- 21. PassManager<Function> : Skipping NOP -- 22. GVNPass ---------------------------------------- define void @test4(i1 %b, i32 %x) { %0: br i1 %b, label %sw, label %case3 %sw: switch i32 %x, label %default [ i32 0, label %case0 i32 1, label %case1 i32 2, label %case0 i32 3, label %case3 i32 4, label %default ] %case0: call void @bar(i32 %x) ret void %default: call void @bar(i32 %x) ret void %case1: call void @bar(i32 %x) ret void %case3: call void @bar(i32 %x) ret void } Transformation seems to be correct! (syntactically equal) -- 23. GVNPass ---------------------------------------- define void @test4(i1 %b, i32 %x) { %0: br i1 %b, label %sw, label %case3 %sw: switch i32 %x, label %default [ i32 0, label %case0 i32 1, label %case1 i32 2, label %case0 i32 3, label %case3 i32 4, label %default ] %case0: call void @bar(i32 %x) ret void %default: call void @bar(i32 %x) ret void %case1: call void @bar(i32 %x) ret void %case3: call void @bar(i32 %x) ret void } => define void @test4(i1 %b, i32 %x) { %0: br i1 %b, label %sw, label %case3 %sw: switch i32 %x, label %default [ i32 0, label %case0 i32 1, label %case1 i32 2, label %case0 i32 3, label %case3 i32 4, label %default ] %case0: call void @bar(i32 %x) ret void %default: call void @bar(i32 %x) ret void %case1: call void @bar(i32 1) ret void %case3: call void @bar(i32 %x) ret void } Transformation seems to be correct! -- 24. PassManager<Function> : Skipping NOP -- 25. PassManager<Function> : Skipping NOP -- 26. GVNPass ---------------------------------------- define i1 @test5(i32 %x, i32 %y) { %0: %cmp = icmp eq i32 %x, %y br i1 %cmp, label %same, label %different %different: %cmp3 = icmp eq i32 %x, %y ret i1 %cmp3 %same: %cmp2 = icmp ne i32 %x, %y ret i1 %cmp2 } Transformation seems to be correct! (syntactically equal) -- 27. GVNPass ---------------------------------------- define i1 @test5(i32 %x, i32 %y) { %0: %cmp = icmp eq i32 %x, %y br i1 %cmp, label %same, label %different %different: %cmp3 = icmp eq i32 %x, %y ret i1 %cmp3 %same: %cmp2 = icmp ne i32 %x, %y ret i1 %cmp2 } => define i1 @test5(i32 %x, i32 %y) { %0: %cmp = icmp eq i32 %x, %y br i1 %cmp, label %same, label %different %different: ret i1 0 %same: ret i1 0 } Transformation seems to be correct! -- 28. PassManager<Function> : Skipping NOP -- 29. PassManager<Function> : Skipping NOP -- 30. GVNPass ---------------------------------------- define i1 @test6(i32 %x, i32 %y) { %0: %cmp2 = icmp ne i32 %x, %y %cmp = icmp eq i32 %x, %y %cmp3 = icmp eq i32 %x, %y br i1 %cmp, label %same, label %different %different: ret i1 %cmp3 %same: ret i1 %cmp2 } Transformation seems to be correct! (syntactically equal) -- 31. GVNPass ---------------------------------------- define i1 @test6(i32 %x, i32 %y) { %0: %cmp2 = icmp ne i32 %x, %y %cmp = icmp eq i32 %x, %y %cmp3 = icmp eq i32 %x, %y br i1 %cmp, label %same, label %different %different: ret i1 %cmp3 %same: ret i1 %cmp2 } => define i1 @test6(i32 %x, i32 %y) { %0: %cmp = icmp eq i32 %x, %y br i1 %cmp, label %same, label %different %different: ret i1 0 %same: ret i1 0 } Transformation seems to be correct! -- 32. PassManager<Function> : Skipping NOP -- 33. PassManager<Function> : Skipping NOP -- 34. GVNPass ---------------------------------------- define i1 @test6_fp(float %x, float %y) { %0: %cmp2 = fcmp une float %x, %y %cmp = fcmp oeq float %x, %y %cmp3 = fcmp oeq float %x, %y br i1 %cmp, label %same, label %different %different: ret i1 %cmp3 %same: ret i1 %cmp2 } Transformation seems to be correct! (syntactically equal) -- 35. GVNPass ---------------------------------------- define i1 @test6_fp(float %x, float %y) { %0: %cmp2 = fcmp une float %x, %y %cmp = fcmp oeq float %x, %y %cmp3 = fcmp oeq float %x, %y br i1 %cmp, label %same, label %different %different: ret i1 %cmp3 %same: ret i1 %cmp2 } => define i1 @test6_fp(float %x, float %y) { %0: %cmp2 = fcmp une float %x, %y %cmp = fcmp oeq float %x, %y br i1 %cmp, label %same, label %different %different: ret i1 0 %same: ret i1 0 } Transformation seems to be correct! -- 36. PassManager<Function> : Skipping NOP -- 37. PassManager<Function> : Skipping NOP -- 38. GVNPass ---------------------------------------- define i1 @test7(i32 %x, i32 %y) { %0: %cmp = icmp sgt i32 %x, %y br i1 %cmp, label %same, label %different %different: %cmp3 = icmp sgt i32 %x, %y ret i1 %cmp3 %same: %cmp2 = icmp sle i32 %x, %y ret i1 %cmp2 } Transformation seems to be correct! (syntactically equal) -- 39. GVNPass ---------------------------------------- define i1 @test7(i32 %x, i32 %y) { %0: %cmp = icmp sgt i32 %x, %y br i1 %cmp, label %same, label %different %different: %cmp3 = icmp sgt i32 %x, %y ret i1 %cmp3 %same: %cmp2 = icmp sle i32 %x, %y ret i1 %cmp2 } => define i1 @test7(i32 %x, i32 %y) { %0: %cmp = icmp sgt i32 %x, %y br i1 %cmp, label %same, label %different %different: ret i1 0 %same: ret i1 0 } Transformation seems to be correct! -- 40. PassManager<Function> : Skipping NOP -- 41. PassManager<Function> : Skipping NOP -- 42. GVNPass ---------------------------------------- define i1 @test7_fp(float %x, float %y) { %0: %cmp = fcmp ogt float %x, %y br i1 %cmp, label %same, label %different %different: %cmp3 = fcmp ogt float %x, %y ret i1 %cmp3 %same: %cmp2 = fcmp ule float %x, %y ret i1 %cmp2 } Transformation seems to be correct! (syntactically equal) -- 43. GVNPass ---------------------------------------- define i1 @test7_fp(float %x, float %y) { %0: %cmp = fcmp ogt float %x, %y br i1 %cmp, label %same, label %different %different: %cmp3 = fcmp ogt float %x, %y ret i1 %cmp3 %same: %cmp2 = fcmp ule float %x, %y ret i1 %cmp2 } => define i1 @test7_fp(float %x, float %y) { %0: %cmp = fcmp ogt float %x, %y br i1 %cmp, label %same, label %different %different: ret i1 0 %same: ret i1 0 } Transformation seems to be correct! -- 44. PassManager<Function> : Skipping NOP -- 45. PassManager<Function> : Skipping NOP -- 46. GVNPass ---------------------------------------- define i1 @test8(i32 %x, i32 %y) { %0: %cmp2 = icmp sle i32 %x, %y %cmp = icmp sgt i32 %x, %y %cmp3 = icmp sgt i32 %x, %y br i1 %cmp, label %same, label %different %different: ret i1 %cmp3 %same: ret i1 %cmp2 } Transformation seems to be correct! (syntactically equal) -- 47. GVNPass ---------------------------------------- define i1 @test8(i32 %x, i32 %y) { %0: %cmp2 = icmp sle i32 %x, %y %cmp = icmp sgt i32 %x, %y %cmp3 = icmp sgt i32 %x, %y br i1 %cmp, label %same, label %different %different: ret i1 %cmp3 %same: ret i1 %cmp2 } => define i1 @test8(i32 %x, i32 %y) { %0: %cmp = icmp sgt i32 %x, %y br i1 %cmp, label %same, label %different %different: ret i1 0 %same: ret i1 0 } Transformation seems to be correct! -- 48. PassManager<Function> : Skipping NOP -- 49. PassManager<Function> : Skipping NOP -- 50. GVNPass ---------------------------------------- define i1 @test8_fp(float %x, float %y) { %0: %cmp2 = fcmp ule float %x, %y %cmp = fcmp ogt float %x, %y %cmp3 = fcmp ogt float %x, %y br i1 %cmp, label %same, label %different %different: ret i1 %cmp3 %same: ret i1 %cmp2 } Transformation seems to be correct! (syntactically equal) -- 51. GVNPass ---------------------------------------- define i1 @test8_fp(float %x, float %y) { %0: %cmp2 = fcmp ule float %x, %y %cmp = fcmp ogt float %x, %y %cmp3 = fcmp ogt float %x, %y br i1 %cmp, label %same, label %different %different: ret i1 %cmp3 %same: ret i1 %cmp2 } => define i1 @test8_fp(float %x, float %y) { %0: %cmp2 = fcmp ule float %x, %y %cmp = fcmp ogt float %x, %y br i1 %cmp, label %same, label %different %different: ret i1 0 %same: ret i1 0 } Transformation seems to be correct! -- 52. PassManager<Function> : Skipping NOP -- 53. PassManager<Function> : Skipping NOP -- 54. GVNPass ---------------------------------------- define i32 @test9(i32 %i, i32 %j) { %0: %cmp = icmp eq i32 %i, %j br i1 %cmp, label %cond_true, label %ret %ret: ret i32 5 %cond_true: %diff = sub i32 %i, %j ret i32 %diff } Transformation seems to be correct! (syntactically equal) -- 55. GVNPass ---------------------------------------- define i32 @test9(i32 %i, i32 %j) { %0: %cmp = icmp eq i32 %i, %j br i1 %cmp, label %cond_true, label %ret %ret: ret i32 5 %cond_true: %diff = sub i32 %i, %j ret i32 %diff } => define i32 @test9(i32 %i, i32 %j) { %0: %cmp = icmp eq i32 %i, %j br i1 %cmp, label %cond_true, label %ret %ret: ret i32 5 %cond_true: ret i32 0 } Transformation seems to be correct! -- 56. PassManager<Function> : Skipping NOP -- 57. PassManager<Function> : Skipping NOP -- 58. GVNPass ---------------------------------------- define i32 @test10(i32 %j, i32 %i) { %0: %cmp = icmp eq i32 %i, %j br i1 %cmp, label %cond_true, label %ret %ret: ret i32 5 %cond_true: %diff = sub i32 %i, %j ret i32 %diff } Transformation seems to be correct! (syntactically equal) -- 59. GVNPass ---------------------------------------- define i32 @test10(i32 %j, i32 %i) { %0: %cmp = icmp eq i32 %i, %j br i1 %cmp, label %cond_true, label %ret %ret: ret i32 5 %cond_true: %diff = sub i32 %i, %j ret i32 %diff } => define i32 @test10(i32 %j, i32 %i) { %0: %cmp = icmp eq i32 %i, %j br i1 %cmp, label %cond_true, label %ret %ret: ret i32 5 %cond_true: ret i32 0 } Transformation seems to be correct! -- 60. PassManager<Function> : Skipping NOP -- 61. PassManager<Function> : Skipping NOP -- 62. GVNPass ---------------------------------------- define i32 @test11(i32 %x) { %0: %v0 = call i32 @yogibar() %v1 = call i32 @yogibar() %cmp = icmp eq i32 %v0, %v1 br i1 %cmp, label %cond_true, label %next %next: %cmp2 = icmp eq i32 %x, %v0 br i1 %cmp2, label %cond_true2, label %next2 %cond_true2: ret i32 %v0 %next2: ret i32 0 %cond_true: ret i32 %v1 } Transformation seems to be correct! (syntactically equal) -- 63. GVNPass ---------------------------------------- define i32 @test11(i32 %x) { %0: %v0 = call i32 @yogibar() %v1 = call i32 @yogibar() %cmp = icmp eq i32 %v0, %v1 br i1 %cmp, label %cond_true, label %next %next: %cmp2 = icmp eq i32 %x, %v0 br i1 %cmp2, label %cond_true2, label %next2 %cond_true2: ret i32 %v0 %next2: ret i32 0 %cond_true: ret i32 %v1 } => define i32 @test11(i32 %x) { %0: %v0 = call i32 @yogibar() %v1 = call i32 @yogibar() %cmp = icmp eq i32 %v0, %v1 br i1 %cmp, label %cond_true, label %next %next: %cmp2 = icmp eq i32 %x, %v0 br i1 %cmp2, label %cond_true2, label %next2 %cond_true2: ret i32 %x %next2: ret i32 0 %cond_true: ret i32 %v0 } Transformation seems to be correct! -- 64. PassManager<Function> : Skipping NOP -- 65. PassManager<Function> : Skipping NOP -- 66. GVNPass ---------------------------------------- define i32 @test12(i32 %x) { %0: %cmp = icmp eq i32 %x, 0 br i1 %cmp, label %cond_true, label %cond_false %cond_false: br label %ret %cond_true: br label %ret %ret: %res = phi i32 [ %x, %cond_true ], [ %x, %cond_false ] ret i32 %res } Transformation seems to be correct! (syntactically equal) -- 67. GVNPass ---------------------------------------- define i32 @test12(i32 %x) { %0: %cmp = icmp eq i32 %x, 0 br i1 %cmp, label %cond_true, label %cond_false %cond_false: br label %ret %cond_true: br label %ret %ret: %res = phi i32 [ %x, %cond_true ], [ %x, %cond_false ] ret i32 %res } => define i32 @test12(i32 %x) { %0: %cmp = icmp eq i32 %x, 0 br i1 %cmp, label %cond_true, label %cond_false %cond_false: br label %ret %cond_true: br label %ret %ret: %res = phi i32 [ 0, %cond_true ], [ %x, %cond_false ] ret i32 %res } Transformation seems to be correct! -- 68. PassManager<Function> : Skipping NOP -- 69. PassManager<Function> : Skipping NOP -- 70. GVNPass ---------------------------------------- define i32 @test13(ptr %ptr1, ptr %ptr2) { %entry: %gep1 = gep ptr %ptr2, 4 x i32 1 %gep2 = gep ptr %ptr2, 4 x i32 2 %cmp = icmp eq ptr %ptr1, %ptr2 br i1 %cmp, label %if, label %end %if: %val1 = load i32, ptr %gep2, align 4 br label %end %end: %phi1 = phi ptr [ %ptr1, %if ], [ %gep1, %entry ] %phi2 = phi i32 [ %val1, %if ], [ 0, %entry ] store i32 0, ptr %phi1, align 4 %val2 = load i32, ptr %gep2, align 4 %ret = add i32 %phi2, %val2 ret i32 %ret } Transformation seems to be correct! (syntactically equal) -- 71. GVNPass ---------------------------------------- define i32 @test13(ptr %ptr1, ptr %ptr2) { %entry: %gep1 = gep ptr %ptr2, 4 x i32 1 %gep2 = gep ptr %ptr2, 4 x i32 2 %cmp = icmp eq ptr %ptr1, %ptr2 br i1 %cmp, label %if, label %end %if: %val1 = load i32, ptr %gep2, align 4 br label %end %end: %phi1 = phi ptr [ %ptr1, %if ], [ %gep1, %entry ] %phi2 = phi i32 [ %val1, %if ], [ 0, %entry ] store i32 0, ptr %phi1, align 4 %val2 = load i32, ptr %gep2, align 4 %ret = add i32 %phi2, %val2 ret i32 %ret } => define i32 @test13(ptr %ptr1, ptr %ptr2) { %entry: %gep1 = gep ptr %ptr2, 4 x i32 1 %gep2 = gep ptr %ptr2, 4 x i32 2 %cmp = icmp eq ptr %ptr1, %ptr2 br i1 %cmp, label %if, label %entry.end_crit_edge %entry.end_crit_edge: %val2.pre = load i32, ptr %gep2, align 4 br label %end %if: %val1 = load i32, ptr %gep2, align 4 br label %end %end: %val2 = phi i32 [ %val1, %if ], [ %val2.pre, %entry.end_crit_edge ] %phi1 = phi ptr [ %ptr2, %if ], [ %gep1, %entry.end_crit_edge ] %phi2 = phi i32 [ %val1, %if ], [ 0, %entry.end_crit_edge ] store i32 0, ptr %phi1, align 4 %ret = add i32 %phi2, %val2 ret i32 %ret } Transformation doesn't verify! (unsound) ERROR: Source is more defined than target Example: ptr %ptr1 = pointer(non-local, block_id=1, offset=56) ptr %ptr2 = pointer(non-local, block_id=2, offset=-8) Source: ptr %gep1 = pointer(non-local, block_id=2, offset=-4) ptr %gep2 = pointer(non-local, block_id=2, offset=0) i1 %cmp = #x1 (1) >> Jump to %if i32 %val1 = poison >> Jump to %end ptr %phi1 = pointer(non-local, block_id=1, offset=56) i32 %phi2 = poison i32 %val2 = poison i32 %ret = poison SOURCE MEMORY STATE =================== NON-LOCAL BLOCKS: Block 0 > size: 0 align: 4 alloc type: 0 address: 0 Block 1 > size: 64 align: 2 alloc type: 0 address: 4 Block 2 > size: 18 align: 17179869184 alloc type: 0 address: 68 Target: ptr %gep1 = pointer(non-local, block_id=2, offset=-4) ptr %gep2 = pointer(non-local, block_id=2, offset=0) i1 %cmp = #x1 (1) >> Jump to %if i32 %val1 = poison >> Jump to %end i32 %val2 = poison ptr %phi1 = pointer(non-local, block_id=2, offset=-8) i32 %phi2 = poison void = UB triggered! Pass: GVNPass 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=gvn' '-S' '-tv-smt-to=20000' '-tv-report-dir=/home/nlopes/alive2/build/logs' '-tv-smt-stats' ------------------- SMT STATS ------------------- Num queries: 91 Num invalid: 0 Num skips: 0 Num trivial: 83 (47.7%) Num timeout: 0 (0.0%) Num errors: 0 (0.0%) Num SAT: 62 (68.1%) Num UNSAT: 29 (31.9%) Alive2: Transform doesn't verify; aborting!
+ : 'RUN: at line 2' + /home/nlopes/alive2/build/opt-alive.sh -passes=gvn -S + /bitbucket/nlopes/llvm/build/bin/FileCheck /bitbucket/nlopes/llvm/llvm/test/Transforms/GVN/condprop.ll FileCheck error: '<stdin>' is empty. FileCheck command line: /bitbucket/nlopes/llvm/build/bin/FileCheck /bitbucket/nlopes/llvm/llvm/test/Transforms/GVN/condprop.ll