Test source: git
Source: <stdin>
-- 1. ModuleToFunctionPassAdaptor
-- 1. PassManager<Function> : Skipping NOP
-- 2. SeparateConstOffsetFromGEPPass
----------------------------------------
define i64 @test1(ptr %array, i64 %i, i64 %j) {
entry:
%add = add nsw i64 %i, 5
%gep = gep inbounds ptr %array, 8 x i64 %add
store i64 %j, ptr %gep, align 8
%add2 = add nsw i64 %i, 6
%gep2 = gep inbounds ptr %array, 8 x i64 %add2
store i64 %j, ptr %gep2, align 8
%add3 = add nsw i64 %i, 35
%gep3 = gep inbounds ptr %array, 8 x i64 %add3
store i64 %add, ptr %gep3, align 8
ret i64 undef
}
Transformation seems to be correct! (syntactically equal)
-- 3. SeparateConstOffsetFromGEPPass
----------------------------------------
define i64 @test1(ptr %array, i64 %i, i64 %j) {
entry:
%add = add nsw i64 %i, 5
%gep = gep inbounds ptr %array, 8 x i64 %add
store i64 %j, ptr %gep, align 8
%add2 = add nsw i64 %i, 6
%gep2 = gep inbounds ptr %array, 8 x i64 %add2
store i64 %j, ptr %gep2, align 8
%add3 = add nsw i64 %i, 35
%gep3 = gep inbounds ptr %array, 8 x i64 %add3
store i64 %add, ptr %gep3, align 8
ret i64 undef
}
=>
define i64 @test1(ptr %array, i64 %i, i64 %j) {
entry:
%add = add nsw i64 %i, 5
%#0 = gep ptr %array, 8 x i64 %i
%gep4 = gep inbounds ptr %#0, 1 x i64 40
store i64 %j, ptr %gep4, align 8
%#1 = gep ptr %array, 8 x i64 %i
%gep26 = gep inbounds ptr %#1, 1 x i64 48
store i64 %j, ptr %gep26, align 8
%#2 = gep ptr %array, 8 x i64 %i
%gep38 = gep inbounds ptr %#2, 1 x i64 280
store i64 %add, ptr %gep38, align 8
ret i64 undef
}
Transformation doesn't verify! (unsound)
ERROR: Source is more defined than target
Example:
ptr %array = pointer(non-local, block_id=1, offset=0) / Address=#x0000000000000008
i64 %i = #xfffffffffffffffb (18446744073709551611, -5)
i64 %j = poison
Source:
i64 %add = #x0000000000000000 (0)
ptr %gep = pointer(non-local, block_id=1, offset=0) / Address=#x0000000000000008
i64 %add2 = #x0000000000000001 (1)
ptr %gep2 = pointer(non-local, block_id=1, offset=8) / Address=#x0000000000000010
i64 %add3 = #x000000000000001e (30)
ptr %gep3 = pointer(non-local, block_id=1, offset=240) / Address=#x00000000000000f8
SOURCE MEMORY STATE
===================
NON-LOCAL BLOCKS:
Block 0 > size: 0 align: 8 alloc type: 0 alive: false address: 0
Block 1 > size: 248 align: 1 alloc type: 0 alive: true address: 8
Target:
i64 %add = #x0000000000000000 (0)
ptr %#0 = pointer(non-local, block_id=1, offset=-40) / Address=#xffffffffffffffe0
ptr %gep4 = poison
void = UB triggered!
Pass: SeparateConstOffsetFromGEPPass
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' '-mtriple=riscv64-unknown-elf' '-passes=separate-const-offset-from-gep,early-cse' '-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_fzYkcLOm_xhYF.bc"
------------------- SMT STATS -------------------
Num queries: 30
Num invalid: 0
Num skips: 0
Num trivial: 10 (25.0%)
Num timeout: 3 (10.0%)
Num errors: 0 (0.0%)
Num SAT: 19 (63.3%)
Num UNSAT: 8 (26.7%)
Alive2: Transform doesn't verify; aborting!
RUN: at line 2: /home/nlopes/alive2/build/opt-alive.sh < /bitbucket/nlopes/llvm/llvm/test/Transforms/SeparateConstOffsetFromGEP/RISCV/split-gep.ll -mtriple=riscv64-unknown-elf -passes='separate-const-offset-from-gep,early-cse' -S | /bitbucket/nlopes/llvm/build/bin/FileCheck /bitbucket/nlopes/llvm/llvm/test/Transforms/SeparateConstOffsetFromGEP/RISCV/split-gep.ll + /home/nlopes/alive2/build/opt-alive.sh -mtriple=riscv64-unknown-elf -passes=separate-const-offset-from-gep,early-cse -S + /bitbucket/nlopes/llvm/build/bin/FileCheck /bitbucket/nlopes/llvm/llvm/test/Transforms/SeparateConstOffsetFromGEP/RISCV/split-gep.ll FileCheck error: '<stdin>' is empty. FileCheck command line: /bitbucket/nlopes/llvm/build/bin/FileCheck /bitbucket/nlopes/llvm/llvm/test/Transforms/SeparateConstOffsetFromGEP/RISCV/split-gep.ll