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

Test source: git

Comments: Alive2 missing support for speculatable attribute

Log:

Source: <stdin>

----------------------------------------
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
}
=>
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!


----------------------------------------
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
}
=>
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!


----------------------------------------
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
}
=>
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!


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

%dispatch:
  %x = call i32 @speculate_call(nonnull * %p) argmemonly
  %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
}
=>
define void @one_pred_with_spec_call(i8 %v0, i8 %v1, * %p) {
%pred:
  %c0 = icmp ne * %p, null
  %x = call i32 @speculate_call(nonnull * %p) argmemonly
  %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!
ERROR: Source is more defined than target

Example:
i8 %v0 = poison
i8 %v1 = poison
* %p = pointer(non-local, block_id=1, offset=-1)

Source:
i1 %c0 = #x0 (0)
i32 %x = poison
i1 %c1 = poison

SOURCE MEMORY STATE
===================
NON-LOCAL BLOCKS:
Block 0 >	size: 0	align: 1	alloc type: 0	address: 0
Block 1 >	size: 1	align: 2	alloc type: 0	address: 1
Block 2 >	size: 0	align: 1	alloc type: 0

Target:
i1 %c0 = #x0 (0)
i32 %x = poison
i1 %c1 = poison
i1 %or.cond = #x0 (0)



------------------- SMT STATS -------------------
Num queries: 17
Num invalid: 0
Num skips:   0
Num trivial: 16 (48.5%)
Num timeout: 0 (0.0%)
Num errors:  0 (0.0%)
Num SAT:     11 (64.7%)
Num UNSAT:   6 (35.3%)
Alive2: Transform doesn't verify; aborting!

stderr:

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

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

 

<-- Back