Test Failure: Transforms/SimplifyCFG/fold-branch-to-common-dest.ll

Test source: git

Comments: Alive2 missing support for speculatable attribute

Log:

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

----------------------------------------
declare void @sideeffect0()
declare void @sideeffect1()

define void @one_pred(i8 %v0, i8 %v1) {
pred:
  %c0 = icmp eq i8 %v0, 0
  br i1 %c0, label %dispatch, label %final_right

dispatch:
  %c1 = icmp eq i8 %v1, 0
  br i1 %c1, label %final_left, label %final_right

final_left:
  call void @sideeffect0()
  ret void

final_right:
  call void @sideeffect1()
  ret void
}
Transformation seems to be correct! (syntactically equal)

-- 3. SimplifyCFGPass

----------------------------------------
declare void @sideeffect0()
declare void @sideeffect1()

define void @one_pred(i8 %v0, i8 %v1) {
pred:
  %c0 = icmp eq i8 %v0, 0
  br i1 %c0, label %dispatch, label %final_right

dispatch:
  %c1 = icmp eq i8 %v1, 0
  br i1 %c1, label %final_left, label %final_right

final_left:
  call void @sideeffect0()
  ret void

final_right:
  call void @sideeffect1()
  ret void
}
=>
declare void @sideeffect1()
declare void @sideeffect0()

define void @one_pred(i8 %v0, i8 %v1) {
pred:
  %c0 = icmp eq i8 %v0, 0
  %c1 = icmp eq i8 %v1, 0
  %or.cond = select i1 %c0, i1 %c1, i1 0
  br i1 %or.cond, label %final_left, label %final_right

final_right:
  call void @sideeffect1()
  br label %common.ret

final_left:
  call void @sideeffect0()
  br label %common.ret

common.ret:
  ret void
}
Transformation seems to be correct!

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

----------------------------------------
declare void @sideeffect0()
declare void @sideeffect1()

define void @two_preds(i8 %v0, i8 %v1, i8 %v2, i8 %v3) {
entry:
  %c0 = icmp eq i8 %v0, 0
  br i1 %c0, label %pred0, label %pred1

pred1:
  %c2 = icmp eq i8 %v2, 0
  br i1 %c2, label %dispatch, label %final_right

pred0:
  %c1 = icmp eq i8 %v1, 0
  br i1 %c1, label %final_left, label %dispatch

dispatch:
  %c3 = icmp eq i8 %v3, 0
  br i1 %c3, label %final_left, label %final_right

final_left:
  call void @sideeffect0()
  ret void

final_right:
  call void @sideeffect1()
  ret void
}
Transformation seems to be correct! (syntactically equal)

-- 7. SimplifyCFGPass

----------------------------------------
declare void @sideeffect0()
declare void @sideeffect1()

define void @two_preds(i8 %v0, i8 %v1, i8 %v2, i8 %v3) {
entry:
  %c0 = icmp eq i8 %v0, 0
  br i1 %c0, label %pred0, label %pred1

pred1:
  %c2 = icmp eq i8 %v2, 0
  br i1 %c2, label %dispatch, label %final_right

pred0:
  %c1 = icmp eq i8 %v1, 0
  br i1 %c1, label %final_left, label %dispatch

dispatch:
  %c3 = icmp eq i8 %v3, 0
  br i1 %c3, label %final_left, label %final_right

final_left:
  call void @sideeffect0()
  ret void

final_right:
  call void @sideeffect1()
  ret void
}
=>
declare void @sideeffect0()
declare void @sideeffect1()

define void @two_preds(i8 %v0, i8 %v1, i8 %v2, i8 %v3) {
entry:
  %c0 = icmp eq i8 %v0, 0
  br i1 %c0, label %pred0, label %pred1

pred1:
  %c2 = icmp eq i8 %v2, 0
  %c3 = icmp eq i8 %v3, 0
  %or.cond = select i1 %c2, i1 %c3, i1 0
  br i1 %or.cond, label %final_left, label %final_right

pred0:
  %c1 = icmp eq i8 %v1, 0
  %c3.old = icmp eq i8 %v3, 0
  %or.cond1 = select i1 %c1, i1 1, i1 %c3.old
  br i1 %or.cond1, label %final_left, label %final_right

final_left:
  call void @sideeffect0()
  br label %common.ret

final_right:
  call void @sideeffect1()
  br label %common.ret

common.ret:
  ret void
}
Transformation seems to be correct!

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

----------------------------------------
declare void @sideeffect0()
declare void @sideeffect1()

define void @one_pred_with_extra_op(i8 %v0, i8 %v1) {
pred:
  %c0 = icmp eq i8 %v0, 0
  br i1 %c0, label %dispatch, label %final_right

dispatch:
  %v1_adj = add i8 %v0, %v1
  %c1 = icmp eq i8 %v1_adj, 0
  br i1 %c1, label %final_left, label %final_right

final_left:
  call void @sideeffect0()
  ret void

final_right:
  call void @sideeffect1()
  ret void
}
Transformation seems to be correct! (syntactically equal)

-- 11. SimplifyCFGPass

----------------------------------------
declare void @sideeffect0()
declare void @sideeffect1()

define void @one_pred_with_extra_op(i8 %v0, i8 %v1) {
pred:
  %c0 = icmp eq i8 %v0, 0
  br i1 %c0, label %dispatch, label %final_right

dispatch:
  %v1_adj = add i8 %v0, %v1
  %c1 = icmp eq i8 %v1_adj, 0
  br i1 %c1, label %final_left, label %final_right

final_left:
  call void @sideeffect0()
  ret void

final_right:
  call void @sideeffect1()
  ret void
}
=>
declare void @sideeffect1()
declare void @sideeffect0()

define void @one_pred_with_extra_op(i8 %v0, i8 %v1) {
pred:
  %c0 = icmp eq i8 %v0, 0
  %v1_adj = add i8 %v0, %v1
  %c1 = icmp eq i8 %v1_adj, 0
  %or.cond = select i1 %c0, i1 %c1, i1 0
  br i1 %or.cond, label %final_left, label %final_right

final_right:
  call void @sideeffect1()
  br label %common.ret

final_left:
  call void @sideeffect0()
  br label %common.ret

common.ret:
  ret void
}
Transformation seems to be correct!

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

----------------------------------------
declare i32 @speculate_call(ptr) memory(argmem: readwrite)
declare void @sideeffect0()

define void @one_pred_with_spec_call(i8 %v0, i8 %v1, ptr %p) {
pred:
  %c0 = icmp ne ptr %p, null
  br i1 %c0, label %dispatch, label %final_right

dispatch:
  %x = call i32 @speculate_call(nonnull ptr %p) memory(argmem: readwrite)
  %c1 = icmp eq i8 %v1, 0
  br i1 %c1, label %final_left, label %final_right

final_left:
  ret void

final_right:
  call void @sideeffect0()
  ret void
}
Transformation seems to be correct! (syntactically equal)

-- 15. SimplifyCFGPass

----------------------------------------
declare i32 @speculate_call(ptr) memory(argmem: readwrite)
declare void @sideeffect0()

define void @one_pred_with_spec_call(i8 %v0, i8 %v1, ptr %p) {
pred:
  %c0 = icmp ne ptr %p, null
  br i1 %c0, label %dispatch, label %final_right

dispatch:
  %x = call i32 @speculate_call(nonnull ptr %p) memory(argmem: readwrite)
  %c1 = icmp eq i8 %v1, 0
  br i1 %c1, label %final_left, label %final_right

final_left:
  ret void

final_right:
  call void @sideeffect0()
  ret void
}
=>
declare i32 @speculate_call(ptr) memory(argmem: readwrite)
declare void @sideeffect0()

define void @one_pred_with_spec_call(i8 %v0, i8 %v1, ptr %p) {
pred:
  %c0 = icmp ne ptr %p, null
  %x = call i32 @speculate_call(nonnull ptr %p) memory(argmem: readwrite)
  %c1 = icmp eq i8 %v1, 0
  %or.cond = select i1 %c0, i1 %c1, i1 0
  br i1 %or.cond, label %common.ret, label %final_right

final_right:
  call void @sideeffect0()
  br label %common.ret

common.ret:
  ret void
}
Transformation doesn't verify! (unsound)
ERROR: Source is more defined than target

Example:
i8 %v0 = poison
i8 %v1 = poison
ptr %p = null

Source:
i1 %c0 = #x0 (0)
  >> Jump to %final_right
void = function did not return!

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

Target:
i1 %c0 = #x0 (0)
Function @speculate_call triggered UB


Pass: SimplifyCFGPass
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' '-S' '-passes=simplifycfg' '-simplifycfg-require-and-preserve-domtree=1' '-bonus-inst-threshold=10' '-tv-smt-to=20000' '-tv-report-dir=/home/nlopes/alive2/build/logs' '-tv-smt-stats'
Wrote bitcode to: "/home/nlopes/alive2/build/logs/in_oJpFnXXc_3M4m.bc"


------------------- SMT STATS -------------------
Num queries: 37
Num invalid: 0
Num skips:   0
Num trivial: 12 (24.5%)
Num timeout: 0 (0.0%)
Num errors:  0 (0.0%)
Num SAT:     25 (67.6%)
Num UNSAT:   12 (32.4%)
Alive2: Transform doesn't verify; aborting!

stderr:

RUN: at line 2: /home/nlopes/alive2/build/opt-alive.sh < /bitbucket/nlopes/llvm/llvm/test/Transforms/SimplifyCFG/fold-branch-to-common-dest.ll -S -passes=simplifycfg -simplifycfg-require-and-preserve-domtree=1 -bonus-inst-threshold=10 | /bitbucket/nlopes/llvm/build/bin/FileCheck /bitbucket/nlopes/llvm/llvm/test/Transforms/SimplifyCFG/fold-branch-to-common-dest.ll
+ /home/nlopes/alive2/build/opt-alive.sh -S -passes=simplifycfg -simplifycfg-require-and-preserve-domtree=1 -bonus-inst-threshold=10
+ /bitbucket/nlopes/llvm/build/bin/FileCheck /bitbucket/nlopes/llvm/llvm/test/Transforms/SimplifyCFG/fold-branch-to-common-dest.ll

FileCheck error: '<stdin>' is empty.
FileCheck command line:  /bitbucket/nlopes/llvm/build/bin/FileCheck /bitbucket/nlopes/llvm/llvm/test/Transforms/SimplifyCFG/fold-branch-to-common-dest.ll

 

<-- Back