Test Failure: Transforms/SimplifyCFG/speculate-call.ll

Test source: git

Comments: Alive2 missing support for speculatable attribute

Log:

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

----------------------------------------
declare i32 @func() nofree memory(none)

define i32 @speculatable_attribute(i32 %a) {
entry:
  %c = icmp sgt i32 %a, 64
  br i1 %c, label %end, label %if

if:
  %val = call i32 @func() nofree memory(none)
  br label %end

end:
  %ret = phi i32 [ %val, %if ], [ 0, %entry ]
  ret i32 %ret
}
Transformation seems to be correct! (syntactically equal)

-- 3. SimplifyCFGPass

----------------------------------------
declare i32 @func() nofree memory(none)

define i32 @speculatable_attribute(i32 %a) {
entry:
  %c = icmp sgt i32 %a, 64
  br i1 %c, label %end, label %if

if:
  %val = call i32 @func() nofree memory(none)
  br label %end

end:
  %ret = phi i32 [ %val, %if ], [ 0, %entry ]
  ret i32 %ret
}
=>
declare i32 @func() nofree memory(none)

define i32 @speculatable_attribute(i32 %a) {
entry:
  %c = icmp sgt i32 %a, 64
  %val = call i32 @func() nofree memory(none)
  %spec.select = select i1 %c, i32 0, i32 %val
  ret i32 %spec.select
}
Transformation doesn't verify! (unsound)
ERROR: Source is more defined than target

Example:
i32 %a = #x00000041 (65)

Source:
i1 %c = #x1 (1)
  >> Jump to %end
i32 %ret = #x00000000 (0)

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

Target:
i1 %c = #x1 (1)
i32 %val = function did not return!


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' '-tv-smt-to=20000' '-tv-report-dir=/home/nlopes/alive2/build/logs' '-tv-smt-stats'
Wrote bitcode to: "/home/nlopes/alive2/build/logs/in_pvg4lmqO_DJks.bc"


------------------- SMT STATS -------------------
Num queries: 10
Num invalid: 0
Num skips:   0
Num trivial: 4 (28.6%)
Num timeout: 0 (0.0%)
Num errors:  0 (0.0%)
Num SAT:     7 (70.0%)
Num UNSAT:   3 (30.0%)
Alive2: Transform doesn't verify; aborting!

stderr:

RUN: at line 1: /home/nlopes/alive2/build/opt-alive.sh -S -passes=simplifycfg -simplifycfg-require-and-preserve-domtree=1 < /bitbucket/nlopes/llvm/llvm/test/Transforms/SimplifyCFG/speculate-call.ll | /bitbucket/nlopes/llvm/build/bin/FileCheck /bitbucket/nlopes/llvm/llvm/test/Transforms/SimplifyCFG/speculate-call.ll
+ /home/nlopes/alive2/build/opt-alive.sh -S -passes=simplifycfg -simplifycfg-require-and-preserve-domtree=1
+ /bitbucket/nlopes/llvm/build/bin/FileCheck /bitbucket/nlopes/llvm/llvm/test/Transforms/SimplifyCFG/speculate-call.ll

FileCheck error: '<stdin>' is empty.
FileCheck command line:  /bitbucket/nlopes/llvm/build/bin/FileCheck /bitbucket/nlopes/llvm/llvm/test/Transforms/SimplifyCFG/speculate-call.ll

 

<-- Back