Test source: git
Comments: LLVM PR51845
Source: <stdin>
-- 1. ModuleToFunctionPassAdaptor
-- 1. PassManager<Function> : Skipping NOP
-- 2. MergeICmpsPass
----------------------------------------
declare void @other_work()
define i1 @test(ptr dereferenceable(2) %arg, ptr dereferenceable(2) %arg1) {
entry:
call void @other_work()
%arg.off = gep inbounds ptr dereferenceable(2) %arg, 1 x i64 1
%arg1.off = gep inbounds ptr dereferenceable(2) %arg1, 1 x i64 1
%arg.off.val = load i8, ptr %arg.off, align 1
%arg1.off.val = load i8, ptr %arg1.off, align 1
%cmp.off = icmp eq i8 %arg.off.val, %arg1.off.val
br i1 %cmp.off, label %if, label %join
if:
%arg.val = load i8, ptr dereferenceable(2) %arg, align 1
%arg1.val = load i8, ptr dereferenceable(2) %arg1, align 1
%cmp = icmp eq i8 %arg.val, %arg1.val
br label %join
join:
%phi = phi i1 [ 0, %entry ], [ %cmp, %if ]
ret i1 %phi
}
Transformation seems to be correct! (syntactically equal)
-- 3. MergeICmpsPass
----------------------------------------
declare void @other_work()
define i1 @test(ptr dereferenceable(2) %arg, ptr dereferenceable(2) %arg1) {
entry:
call void @other_work()
%arg.off = gep inbounds ptr dereferenceable(2) %arg, 1 x i64 1
%arg1.off = gep inbounds ptr dereferenceable(2) %arg1, 1 x i64 1
%arg.off.val = load i8, ptr %arg.off, align 1
%arg1.off.val = load i8, ptr %arg1.off, align 1
%cmp.off = icmp eq i8 %arg.off.val, %arg1.off.val
br i1 %cmp.off, label %if, label %join
if:
%arg.val = load i8, ptr dereferenceable(2) %arg, align 1
%arg1.val = load i8, ptr dereferenceable(2) %arg1, align 1
%cmp = icmp eq i8 %arg.val, %arg1.val
br label %join
join:
%phi = phi i1 [ 0, %entry ], [ %cmp, %if ]
ret i1 %phi
}
=>
declare void @other_work()
declare i32 @memcmp(nocapture ptr, nocapture ptr, i64) nofree willreturn memory(argmem: read)
define i1 @test(ptr dereferenceable(2) %arg, ptr dereferenceable(2) %arg1) {
if+entry:
call void @other_work()
%memcmp = memcmp ptr dereferenceable(2) %arg, ptr dereferenceable(2) %arg1, i64 2
%#0 = icmp eq i32 %memcmp, 0
br label %join
join:
ret i1 %#0
}
Transformation doesn't verify! (unsound)
ERROR: Target is more poisonous than source
Example:
ptr dereferenceable(2) %arg = pointer(non-local, block_id=1, offset=6) / Address=#x0e
ptr dereferenceable(2) %arg1 = pointer(non-local, block_id=1, offset=12) / Address=#x14
Source:
Function @other_work returned
ptr %arg.off = pointer(non-local, block_id=1, offset=7) / Address=#x0f
ptr %arg1.off = pointer(non-local, block_id=1, offset=13) / Address=#x15
i8 %arg.off.val = #x00 (0)
i8 %arg1.off.val = #x02 (2)
i1 %cmp.off = #x0 (0)
>> Jump to %join
i1 %phi = #x0 (0)
SOURCE MEMORY STATE
===================
NON-LOCAL BLOCKS:
Block 0 > size: 0 align: 1 alloc type: 0 alive: false address: #x00
Block 1 > size: 15 align: 1 alloc type: 0 alive: true address: #x08
Contents:
6: poison
13: #x02
12: poison
7: #x00
*: poison
Block 2 > size: 0 align: 1 alloc type: 0 alive: true address: #x06
Contents:
13: poison
*: poison
Block 3 > size: 0 align: 1 alloc type: 0 alive: true address: #x07
Target:
Function @other_work returned
i32 %memcmp = poison
i1 %#0 = poison
>> Jump to %join
TARGET MEMORY STATE
===================
NON-LOCAL BLOCKS:
Block 0 > size: 0 align: 1 alloc type: 0 alive: false address: #x00
Block 1 > size: 15 align: 1 alloc type: 0 alive: true address: #x08
Contents:
6: poison
13: #x02
12: poison
7: #x00
*: poison
Block 2 > size: 0 align: 1 alloc type: 0 alive: true address: #x06
Contents:
13: poison
*: poison
Block 3 > size: 0 align: 1 alloc type: 0 alive: true address: #x07
Source value: #x0 (0)
Target value: poison
Pass: MergeICmpsPass
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=mergeicmps' '-tv-smt-to=20000' '-tv-report-dir=/home/nlopes/alive2/build/logs' '-tv-smt-stats'
Wrote bitcode to: "/home/nlopes/alive2/build/logs/in_ud7BcJn3_V1ip.bc"
------------------- SMT STATS -------------------
Num queries: 49
Num invalid: 0
Num skips: 0
Num trivial: 9 (15.5%)
Num timeout: 0 (0.0%)
Num errors: 0 (0.0%)
Num SAT: 34 (69.4%)
Num UNSAT: 15 (30.6%)
Alive2: Transform doesn't verify; aborting!
Transforms/MergeICmps/X86/no-gep-other-work.ll' FAILED ******************** Exit Code: 2 Command Output (stdout): -- # RUN: at line 2 /home/nlopes/alive2/build/opt-alive.sh -S -passes=mergeicmps < /bitbucket/nlopes/llvm/llvm/test/Transforms/MergeICmps/X86/no-gep-other-work.ll | /bitbucket/nlopes/llvm/build/bin/FileCheck /bitbucket/nlopes/llvm/llvm/test/Transforms/MergeICmps/X86/no-gep-other-work.ll # executed command: /home/nlopes/alive2/build/opt-alive.sh -S -passes=mergeicmps # .---command stderr------------ # `----------------------------- # error: command failed with exit status: 1 # executed command: /bitbucket/nlopes/llvm/build/bin/FileCheck /bitbucket/nlopes/llvm/llvm/test/Transforms/MergeICmps/X86/no-gep-other-work.ll # .---command stderr------------ # | FileCheck error: '<stdin>' is empty. # | FileCheck command line: /bitbucket/nlopes/llvm/build/bin/FileCheck /bitbucket/nlopes/llvm/llvm/test/Transforms/MergeICmps/X86/no-gep-other-work.ll # `----------------------------- # error: command failed with exit status: 2 --