Test source: git
Source: <stdin>
-- 1. ModuleToFunctionPassAdaptor
-- 1. PassManager<Function> : Skipping NOP
-- 2. StraightLineStrengthReducePass
----------------------------------------
define void @foo(ptr %a, ptr %b, i32 %j) {
#0:
%i.0 = load i32, ptr %a, align 8
%i = add i32 %i.0, %j
%gep.24 = gep ptr %b, 4 x i32 %i
store i32 0, ptr %gep.24, align 4
%gep.24.sum1 = add i32 %i, %i
%gep.25 = gep ptr %b, 4 x i32 %gep.24.sum1
store i32 1, ptr %gep.25, align 4
%gep.26.sum3 = add i32 1, %i
%gep.27.sum = add i32 %gep.26.sum3, %i
%gep.28 = gep ptr %b, 4 x i32 %gep.27.sum
store i32 2, ptr %gep.28, align 4
%gep.28.sum = add i32 %gep.27.sum, %i
%gep.29 = gep ptr %b, 4 x i32 %gep.28.sum
store i32 3, ptr %gep.29, align 4
%gep.29.sum = add i32 %gep.28.sum, %i
%gep.30 = gep ptr %b, 4 x i32 %gep.29.sum
store i32 4, ptr %gep.30, align 4
ret void
}
Transformation seems to be correct! (syntactically equal)
-- 3. StraightLineStrengthReducePass
----------------------------------------
define void @foo(ptr %a, ptr %b, i32 %j) {
#0:
%i.0 = load i32, ptr %a, align 8
%i = add i32 %i.0, %j
%gep.24 = gep ptr %b, 4 x i32 %i
store i32 0, ptr %gep.24, align 4
%gep.24.sum1 = add i32 %i, %i
%gep.25 = gep ptr %b, 4 x i32 %gep.24.sum1
store i32 1, ptr %gep.25, align 4
%gep.26.sum3 = add i32 1, %i
%gep.27.sum = add i32 %gep.26.sum3, %i
%gep.28 = gep ptr %b, 4 x i32 %gep.27.sum
store i32 2, ptr %gep.28, align 4
%gep.28.sum = add i32 %gep.27.sum, %i
%gep.29 = gep ptr %b, 4 x i32 %gep.28.sum
store i32 3, ptr %gep.29, align 4
%gep.29.sum = add i32 %gep.28.sum, %i
%gep.30 = gep ptr %b, 4 x i32 %gep.29.sum
store i32 4, ptr %gep.30, align 4
ret void
}
=>
define void @foo(ptr %a, ptr %b, i32 %j) {
#0:
%i.0 = load i32, ptr %a, align 8
%i = add i32 %i.0, %j
%gep.24 = gep ptr %b, 4 x i32 %i
store i32 0, ptr %gep.24, align 4
%#1 = sext i32 %i to i64
%#2 = shl i64 %#1, 2
%gep.25 = gep ptr %gep.24, 1 x i64 %#2
store i32 1, ptr %gep.25, align 4
%gep.28 = gep ptr %gep.25, 1 x i64 4
store i32 2, ptr %gep.28, align 4
%#3 = sext i32 %i to i64
%#4 = shl i64 %#3, 2
%gep.29 = gep ptr %gep.28, 1 x i64 %#4
store i32 3, ptr %gep.29, align 4
%#5 = sext i32 %i to i64
%#6 = shl i64 %#5, 2
%gep.30 = gep ptr %gep.29, 1 x i64 %#6
store i32 4, ptr %gep.30, align 4
ret void
}
Transformation doesn't verify! (unsound)
ERROR: Source is more defined than target
Example:
ptr %a = pointer(non-local, block_id=1, offset=0) / Address=#x0000000000000008
ptr %b = pointer(non-local, block_id=1, offset=12) / Address=#x0000000000000014
i32 %j = #x00000000 (0)
Source:
i32 %i.0 = #x7fffffff (2147483647)
i32 %i = #x7fffffff (2147483647)
ptr %gep.24 = pointer(non-local, block_id=1, offset=8589934600) / Address=#x0000000200000010
i32 %gep.24.sum1 = #xfffffffe (4294967294, -2)
ptr %gep.25 = pointer(non-local, block_id=1, offset=4) / Address=#x000000000000000c
i32 %gep.26.sum3 = #x80000000 (2147483648, -2147483648)
i32 %gep.27.sum = #xffffffff (4294967295, -1)
ptr %gep.28 = pointer(non-local, block_id=1, offset=8) / Address=#x0000000000000010
i32 %gep.28.sum = #x7ffffffe (2147483646)
ptr %gep.29 = pointer(non-local, block_id=1, offset=8589934596) / Address=#x000000020000000c
i32 %gep.29.sum = #xfffffffd (4294967293, -3)
ptr %gep.30 = pointer(non-local, block_id=1, offset=0) / Address=#x0000000000000008
SOURCE MEMORY STATE
===================
NON-LOCAL BLOCKS:
Block 0 > size: 0 align: 4 alloc type: 0 alive: false address: #x0000000000000000
Block 1 > size: 17179869186 align: 1 alloc type: 0 alive: true address: #x0000000000000008
Contents:
*: #x7fffffff
Block 2 > size: 0 align: 1 alloc type: 4 alive: true address: #x0000000000000001
Target:
i32 %i.0 = #x7fffffff (2147483647)
i32 %i = #x7fffffff (2147483647)
ptr %gep.24 = pointer(non-local, block_id=1, offset=8589934600) / Address=#x0000000200000010
i64 %#1 = #x000000007fffffff (2147483647)
i64 %#2 = #x00000001fffffffc (8589934588)
ptr %gep.25 = pointer(non-local, block_id=1, offset=17179869188) / Address=#x000000040000000c
void = UB triggered!
TARGET MEMORY STATE
===================
NON-LOCAL BLOCKS:
Block 0 > size: 0 align: 4 alloc type: 0 alive: false address: #x0000000000000000
Block 1 > size: 17179869186 align: 1 alloc type: 0 alive: true address: #x0000000000000008
Contents:
*: #x7fffffff
Block 2 > size: 0 align: 1 alloc type: 4 alive: true address: #x0000000000000001
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' '-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_KJT1edJO_9L3L.bc"
------------------- SMT STATS -------------------
Num queries: 42
Num invalid: 0
Num skips: 0
Num trivial: 21 (33.3%)
Num timeout: 0 (0.0%)
Num errors: 0 (0.0%)
Num SAT: 27 (64.3%)
Num UNSAT: 15 (35.7%)
Alive2: Transform doesn't verify; aborting!
Transforms/StraightLineStrengthReduce/NVPTX/slsr-var-delta.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/StraightLineStrengthReduce/NVPTX/slsr-var-delta.ll -passes=slsr -S | /bitbucket/nlopes/llvm/build/bin/FileCheck /bitbucket/nlopes/llvm/llvm/test/Transforms/StraightLineStrengthReduce/NVPTX/slsr-var-delta.ll # executed command: /home/nlopes/alive2/build/opt-alive.sh -passes=slsr -S # .---command stderr------------ # `----------------------------- # error: command failed with exit status: 1 # executed command: /bitbucket/nlopes/llvm/build/bin/FileCheck /bitbucket/nlopes/llvm/llvm/test/Transforms/StraightLineStrengthReduce/NVPTX/slsr-var-delta.ll # .---command stderr------------ # | FileCheck error: '<stdin>' is empty. # | FileCheck command line: /bitbucket/nlopes/llvm/build/bin/FileCheck /bitbucket/nlopes/llvm/llvm/test/Transforms/StraightLineStrengthReduce/NVPTX/slsr-var-delta.ll # `----------------------------- # error: command failed with exit status: 2 --