Test source: git
Source: <stdin>
----------------------------------------
declare i32 @memcmp(nocapture ptr, nocapture ptr, i64)
define i32 @cmp2(ptr nocapture nowrite %x, ptr nocapture nowrite %y) {
#0:
%call = memcmp ptr nocapture nowrite %x, ptr nocapture nowrite %y, i64 2
ret i32 %call
}
=>
define i32 @cmp2(ptr nocapture nowrite %x, ptr nocapture nowrite %y) {
#0:
%#1 = load i16, ptr nocapture nowrite %x, align 1
%#2 = load i16, ptr nocapture nowrite %y, align 1
%#3 = bswap i16 %#1
%#4 = bswap i16 %#2
%#5 = zext i16 %#3 to i32
%#6 = zext i16 %#4 to i32
%#7 = sub i32 %#5, %#6
ret i32 %#7
}
Transformation doesn't verify! (unsound)
ERROR: Target is more poisonous than source
Example:
ptr nocapture nowrite %x = pointer(non-local, block_id=1, offset=0, attrs=3) / Address=#x8
ptr nocapture nowrite %y = pointer(non-local, block_id=1, offset=0, attrs=3) / Address=#x8
Source:
i32 %call = #x00000000 (0)
SOURCE MEMORY STATE
===================
NON-LOCAL BLOCKS:
Block 0 > size: 0 align: 1 alloc type: 0 alive: false address: 0
Block 1 > size: 3 align: 34359738368 alloc type: 0 alive: true address: 8
Contents:
1: null, byte offset=0
*: #x00
Block 2 > size: 1 align: 2 alloc type: 0 alive: true address: 2
Target:
i16 %#1 = poison
i16 %#2 = poison
i16 %#3 = poison
i16 %#4 = poison
i32 %#5 = poison
i32 %#6 = poison
i32 %#7 = poison
Source value: #x00000000 (0)
Target value: poison
Pass:
Command line: '/home/nlopes/llvm/build/bin/opt' '-load=/home/nlopes/alive2/build/tv/tv.so' '-tv-exit-on-error' '-tv' '-S' '-expand-memcmp' '-memcmp-num-loads-per-block=1' '-mtriple=aarch64-unknown-unknown' '-tv' '-tv-smt-to=20000' '-tv-report-dir=/home/nlopes/alive2/build/logs' '-tv-smt-stats'
------------------- SMT STATS -------------------
Num queries: 22
Num invalid: 0
Num skips: 0
Num trivial: 5 (18.5%)
Num timeout: 0 (0.0%)
Num errors: 0 (0.0%)
Num SAT: 11 (50.0%)
Num UNSAT: 11 (50.0%)
Alive2: Transform doesn't verify; aborting!
RUN: at line 2: /home/nlopes/alive2/build/opt-alive.sh -S -expand-memcmp -memcmp-num-loads-per-block=1 -mtriple=aarch64-unknown-unknown < /bitbucket/nlopes/llvm/llvm/test/Transforms/ExpandMemCmp/AArch64/memcmp.ll | /bitbucket/nlopes/llvm/build/bin/FileCheck /bitbucket/nlopes/llvm/llvm/test/Transforms/ExpandMemCmp/AArch64/memcmp.ll + /home/nlopes/alive2/build/opt-alive.sh -S -expand-memcmp -memcmp-num-loads-per-block=1 -mtriple=aarch64-unknown-unknown + /bitbucket/nlopes/llvm/build/bin/FileCheck /bitbucket/nlopes/llvm/llvm/test/Transforms/ExpandMemCmp/AArch64/memcmp.ll FileCheck error: '<stdin>' is empty. FileCheck command line: /bitbucket/nlopes/llvm/build/bin/FileCheck /bitbucket/nlopes/llvm/llvm/test/Transforms/ExpandMemCmp/AArch64/memcmp.ll