Test source: git
Source: <stdin>
-- 1. ModuleToFunctionPassAdaptor
-- 1. PassManager<Function> : Skipping NOP
-- 2. SimplifyCFGPass
----------------------------------------
declare ptr @foo2(ptr, ptr, i64)
declare void @side.effect()
define ptr @test_hoist_int_attrs(i1 %c, ptr %p, ptr %p2, i64 %x) {
#0:
br i1 %c, label %if, label %else
else:
%#range_0_%x = !range i64 %x, i64 10000, i64 100000
%r2 = call ptr @foo2(align(32) dereferenceable_or_null(200) ptr %p, dereferenceable(100) align(32) ptr %p2, i64 %#range_0_%x) memory(write)
call void @side.effect()
ret ptr %r2
if:
%#range_1_%x = !range i64 %x, i64 10, i64 1000
%r = call ptr @foo2(align(64) dereferenceable_or_null(100) ptr %p, dereferenceable(50) align(64) ptr %p2, i64 %#range_1_%x) nofree memory(read)
ret ptr %r
}
Transformation seems to be correct! (syntactically equal)
-- 3. SimplifyCFGPass
----------------------------------------
declare ptr @foo2(ptr, ptr, i64)
declare void @side.effect()
define ptr @test_hoist_int_attrs(i1 %c, ptr %p, ptr %p2, i64 %x) {
#0:
br i1 %c, label %if, label %else
else:
%#range_0_%x = !range i64 %x, i64 10000, i64 100000
%r2 = call ptr @foo2(align(32) dereferenceable_or_null(200) ptr %p, dereferenceable(100) align(32) ptr %p2, i64 %#range_0_%x) memory(write)
call void @side.effect()
ret ptr %r2
if:
%#range_1_%x = !range i64 %x, i64 10, i64 1000
%r = call ptr @foo2(align(64) dereferenceable_or_null(100) ptr %p, dereferenceable(50) align(64) ptr %p2, i64 %#range_1_%x) nofree memory(read)
ret ptr %r
}
=>
declare ptr @foo2(ptr, ptr, i64)
declare void @side.effect()
define ptr @test_hoist_int_attrs(i1 %c, ptr %p, ptr %p2, i64 %x) {
#0:
%#range_0_%x = !range i64 %x, i64 10, i64 100000
%r = call ptr @foo2(align(32) dereferenceable_or_null(100) ptr %p, dereferenceable(50) align(32) ptr %p2, i64 %#range_0_%x)
br i1 %c, label %common.ret, label %else
else:
call void @side.effect()
br label %common.ret
common.ret:
ret ptr %r
}
Transformation doesn't verify! (unsound)
ERROR: Mismatch in memory
Example:
i1 %c = #x1 (1)
ptr %p = null
ptr %p2 = pointer(non-local, block_id=1, offset=0) / Address=#x040
i64 %x = #x0000000000000000 (0)
Source:
>> Jump to %if
i64 %#range_1_%x = poison
ptr %r = null
SOURCE MEMORY STATE
===================
NON-LOCAL BLOCKS:
Block 0 > size: 0 align: 1 alloc type: 0 alive: false address: #x000
Block 1 > size: 2 align: 64 alloc type: 4 alive: true address: #x040
Block 2 > size: 0 align: 1 alloc type: 0 alive: true address: #x004
Block 3 > size: 0 align: 1 alloc type: 4 alive: true address: #x004
Block 4 > size: 0 align: 1 alloc type: 4 alive: true address: #x008
Target:
i64 %#range_0_%x = poison
ptr %r = null
>> Jump to %common.ret
TARGET MEMORY STATE
===================
NON-LOCAL BLOCKS:
Block 0 > size: 0 align: 1 alloc type: 0 alive: false address: #x000
Block 1 > size: 3 align: 64 alloc type: 4 alive: true address: #x040
Block 2 > size: 0 align: 1 alloc type: 0 alive: true address: #x004
Block 3 > size: 0 align: 1 alloc type: 4 alive: true address: #x004
Block 4 > size: 0 align: 1 alloc type: 4 alive: true address: #x008
Mismatch in pointer(non-local, block_id=1, offset=0)
Source value: poison
Target value: poison
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' '-passes=simplifycfg<hoist-common-insts>' '-simplifycfg-require-and-preserve-domtree=1' '-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_ADlPxKkx_sxnS.bc"
------------------- SMT STATS -------------------
Num queries: 83
Num invalid: 0
Num skips: 0
Num trivial: 7 (7.8%)
Num timeout: 0 (0.0%)
Num errors: 0 (0.0%)
Num SAT: 60 (72.3%)
Num UNSAT: 23 (27.7%)
Alive2: Transform doesn't verify; aborting!
Transforms/SimplifyCFG/hoist-cb-diff-attrs.ll' FAILED ******************** Exit Code: 2 Command Output (stdout): -- # RUN: at line 2 /home/nlopes/alive2/build/opt-alive.sh < /bitbucket/nlopes/llvm/llvm/test/Transforms/SimplifyCFG/hoist-cb-diff-attrs.ll -passes='simplifycfg<hoist-common-insts>' -simplifycfg-require-and-preserve-domtree=1 -S | /bitbucket/nlopes/llvm/build/bin/FileCheck /bitbucket/nlopes/llvm/llvm/test/Transforms/SimplifyCFG/hoist-cb-diff-attrs.ll # executed command: /home/nlopes/alive2/build/opt-alive.sh '-passes=simplifycfg<hoist-common-insts>' -simplifycfg-require-and-preserve-domtree=1 -S # .---command stderr------------ # `----------------------------- # error: command failed with exit status: 1 # executed command: /bitbucket/nlopes/llvm/build/bin/FileCheck /bitbucket/nlopes/llvm/llvm/test/Transforms/SimplifyCFG/hoist-cb-diff-attrs.ll # .---command stderr------------ # | FileCheck error: '<stdin>' is empty. # | FileCheck command line: /bitbucket/nlopes/llvm/build/bin/FileCheck /bitbucket/nlopes/llvm/llvm/test/Transforms/SimplifyCFG/hoist-cb-diff-attrs.ll # `----------------------------- # error: command failed with exit status: 2 --