Test source: git
Source: <stdin>
-- 1. ModuleToFunctionPassAdaptor
-- 1. PassManager<Function> : Skipping NOP
-- 2. StraightLineStrengthReducePass
----------------------------------------
declare void @foo(i32)
define void @nary_reassociate_after_slsr(i32 %a, i32 %b, i32 %c) {
#0:
%ab = add i32 %a, %b
%abc = add i32 %ab, %c
call void @foo(i32 %abc)
%b2 = shl i32 %b, 1
%ab2 = add i32 %a, %b2
%ab2c = add i32 %ab2, %c
call void @foo(i32 %ab2c)
%b3 = mul i32 %b, 3
%ab3 = add i32 %a, %b3
%ab3c = add i32 %ab3, %c
call void @foo(i32 %ab3c)
ret void
}
Transformation seems to be correct! (syntactically equal)
-- 3. StraightLineStrengthReducePass
----------------------------------------
declare void @foo(i32)
define void @nary_reassociate_after_slsr(i32 %a, i32 %b, i32 %c) {
#0:
%ab = add i32 %a, %b
%abc = add i32 %ab, %c
call void @foo(i32 %abc)
%b2 = shl i32 %b, 1
%ab2 = add i32 %a, %b2
%ab2c = add i32 %ab2, %c
call void @foo(i32 %ab2c)
%b3 = mul i32 %b, 3
%ab3 = add i32 %a, %b3
%ab3c = add i32 %ab3, %c
call void @foo(i32 %ab3c)
ret void
}
=>
declare void @foo(i32)
define void @nary_reassociate_after_slsr(i32 %a, i32 %b, i32 %c) {
#0:
%ab = add i32 %a, %b
%abc = add i32 %ab, %c
call void @foo(i32 %abc)
%ab2 = add i32 %ab, %b
%ab2c = add i32 %ab2, %c
call void @foo(i32 %ab2c)
%ab3 = add i32 %ab2, %b
%ab3c = add i32 %ab3, %c
call void @foo(i32 %ab3c)
ret void
}
Transformation doesn't verify! (unsound)
ERROR: Source is more defined than target
Example:
i32 %a = #x00000000 (0)
i32 %b = undef
i32 %c = #x00000000 (0)
Source:
i32 %ab = #x00000000 (0) [based on undef value]
i32 %abc = #x00000000 (0)
Function @foo returned
i32 %b2 = #x00000000 (0) [based on undef value]
i32 %ab2 = #x00000000 (0)
i32 %ab2c = #x00000000 (0)
void = function did not return!
SOURCE MEMORY STATE
===================
NON-LOCAL BLOCKS:
Block 0 > size: 0 align: 1 alloc type: 0 alive: false address: 0
Block 1 > size: 8 align: 1 alloc type: 0 alive: true address: 1
Target:
i32 %ab = #x00000000 (0)
i32 %abc = #x00000000 (0)
Function @foo returned
i32 %ab2 = #x00000001 (1)
i32 %ab2c = #x00000001 (1)
void = function did not return!
Pass: StraightLineStrengthReducePass
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=slsr,nary-reassociate' '-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_wI0ZlhrA_UXwn.bc"
------------------- SMT STATS -------------------
Num queries: 47
Num invalid: 0
Num skips: 0
Num trivial: 12 (20.3%)
Num timeout: 7 (14.9%)
Num errors: 0 (0.0%)
Num SAT: 37 (78.7%)
Num UNSAT: 3 (6.4%)
Alive2: Transform doesn't verify; aborting!
RUN: at line 1: /home/nlopes/alive2/build/opt-alive.sh < /bitbucket/nlopes/llvm/llvm/test/Transforms/NaryReassociate/NVPTX/nary-slsr.ll -passes=slsr,nary-reassociate -S | /bitbucket/nlopes/llvm/build/bin/FileCheck /bitbucket/nlopes/llvm/llvm/test/Transforms/NaryReassociate/NVPTX/nary-slsr.ll + /home/nlopes/alive2/build/opt-alive.sh -passes=slsr,nary-reassociate -S + /bitbucket/nlopes/llvm/build/bin/FileCheck /bitbucket/nlopes/llvm/llvm/test/Transforms/NaryReassociate/NVPTX/nary-slsr.ll FileCheck error: '<stdin>' is empty. FileCheck command line: /bitbucket/nlopes/llvm/build/bin/FileCheck /bitbucket/nlopes/llvm/llvm/test/Transforms/NaryReassociate/NVPTX/nary-slsr.ll
NOTE: This test would pass if undef didn't exist!