Test source: git
Source: <stdin> -- 1. ModuleToFunctionPassAdaptor -- 1. PassManager<llvm::Function> : Skipping NOP -- 2. SeparateConstOffsetFromGEPPass ---------------------------------------- declare void @foo(float) define void @slsr_after_reassociate_geps(ptr %arr, i32 %i) { #0: %i2 = shl nsw i32 %i, 1 %i3 = mul nsw i32 %i, 3 %i4 = shl nsw i32 %i, 2 %j1 = add nsw i32 %i, 5 %p1 = gep inbounds ptr %arr, 4 x i32 %j1 %v1 = load float, ptr %p1, align 4 call void @foo(float %v1) %j2 = add nsw i32 %i2, 5 %p2 = gep inbounds ptr %arr, 4 x i32 %j2 %v2 = load float, ptr %p2, align 4 call void @foo(float %v2) %j3 = add nsw i32 %i3, 5 %p3 = gep inbounds ptr %arr, 4 x i32 %j3 %v3 = load float, ptr %p3, align 4 call void @foo(float %v3) %j4 = add nsw i32 %i4, 5 %p4 = gep inbounds ptr %arr, 4 x i32 %j4 %v4 = load float, ptr %p4, align 4 call void @foo(float %v4) ret void } Transformation seems to be correct! (syntactically equal) -- 3. SeparateConstOffsetFromGEPPass ---------------------------------------- declare void @foo(float) define void @slsr_after_reassociate_geps(ptr %arr, i32 %i) { #0: %i2 = shl nsw i32 %i, 1 %i3 = mul nsw i32 %i, 3 %i4 = shl nsw i32 %i, 2 %j1 = add nsw i32 %i, 5 %p1 = gep inbounds ptr %arr, 4 x i32 %j1 %v1 = load float, ptr %p1, align 4 call void @foo(float %v1) %j2 = add nsw i32 %i2, 5 %p2 = gep inbounds ptr %arr, 4 x i32 %j2 %v2 = load float, ptr %p2, align 4 call void @foo(float %v2) %j3 = add nsw i32 %i3, 5 %p3 = gep inbounds ptr %arr, 4 x i32 %j3 %v3 = load float, ptr %p3, align 4 call void @foo(float %v3) %j4 = add nsw i32 %i4, 5 %p4 = gep inbounds ptr %arr, 4 x i32 %j4 %v4 = load float, ptr %p4, align 4 call void @foo(float %v4) ret void } => declare void @foo(float) define void @slsr_after_reassociate_geps(ptr %arr, i32 %i) { #0: %i2 = shl nsw i32 %i, 1 %i3 = mul nsw i32 %i, 3 %i4 = shl nsw i32 %i, 2 %#1 = sext i32 %i to i64 %#2 = gep ptr %arr, 4 x i64 %#1 %p12 = gep inbounds ptr %#2, 1 x i64 20 %v1 = load float, ptr %p12, align 4 call void @foo(float %v1) %#3 = sext i32 %i2 to i64 %#4 = gep ptr %arr, 4 x i64 %#3 %p24 = gep inbounds ptr %#4, 1 x i64 20 %v2 = load float, ptr %p24, align 4 call void @foo(float %v2) %#5 = sext i32 %i3 to i64 %#6 = gep ptr %arr, 4 x i64 %#5 %p36 = gep inbounds ptr %#6, 1 x i64 20 %v3 = load float, ptr %p36, align 4 call void @foo(float %v3) %#7 = sext i32 %i4 to i64 %#8 = gep ptr %arr, 4 x i64 %#7 %p48 = gep inbounds ptr %#8, 1 x i64 20 %v4 = load float, ptr %p48, align 4 call void @foo(float %v4) ret void } Transformation doesn't verify! (unsound) ERROR: Source is more defined than target Example: ptr %arr = pointer(non-local, block_id=1, offset=0) / Address=#x0000000004 i32 %i = #xfffffffc (4294967292, -4) Source: i32 %i2 = #xfffffff8 (4294967288, -8) i32 %i3 = #xfffffff4 (4294967284, -12) i32 %i4 = #xfffffff0 (4294967280, -16) i32 %j1 = #x00000001 (1) ptr %p1 = pointer(non-local, block_id=1, offset=4) / Address=#x0000000008 float %v1 = #x00000000 (+0.0) void = function did not return! SOURCE MEMORY STATE =================== NON-LOCAL BLOCKS: Block 0 > size: 0 align: 4 alloc type: 0 alive: false address: 0 Block 1 > size: 8 align: 1 alloc type: 0 alive: true address: 4 Contents: 1: #x00000000 *: poison Block 2 > size: 0 align: 1 alloc type: 0 alive: true address: 13 Target: i32 %i2 = #xfffffff8 (4294967288, -8) i32 %i3 = #xfffffff4 (4294967284, -12) i32 %i4 = #xfffffff0 (4294967280, -16) i64 %#1 = #xfffffffffffffffc (18446744073709551612, -4) ptr %#2 = pointer(non-local, block_id=1, offset=-16) / Address=#xfffffffff4 ptr %p12 = poison float %v1 = 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' '-passes=separate-const-offset-from-gep,slsr,gvn' '-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_WLmXIZGa_GZLK.bc" ------------------- SMT STATS ------------------- Num queries: 48 Num invalid: 0 Num skips: 0 Num trivial: 13 (21.3%) Num timeout: 0 (0.0%) Num errors: 0 (0.0%) Num SAT: 38 (79.2%) Num UNSAT: 10 (20.8%) Alive2: Transform doesn't verify; aborting!
RUN: at line 2: /home/nlopes/alive2/build/opt-alive.sh < /bitbucket/nlopes/llvm/llvm/test/Transforms/StraightLineStrengthReduce/NVPTX/reassociate-geps-and-slsr.ll -passes=separate-const-offset-from-gep,slsr,gvn -S | /bitbucket/nlopes/llvm/build/bin/FileCheck /bitbucket/nlopes/llvm/llvm/test/Transforms/StraightLineStrengthReduce/NVPTX/reassociate-geps-and-slsr.ll + /bitbucket/nlopes/llvm/build/bin/FileCheck /bitbucket/nlopes/llvm/llvm/test/Transforms/StraightLineStrengthReduce/NVPTX/reassociate-geps-and-slsr.ll + /home/nlopes/alive2/build/opt-alive.sh -passes=separate-const-offset-from-gep,slsr,gvn -S FileCheck error: '<stdin>' is empty. FileCheck command line: /bitbucket/nlopes/llvm/build/bin/FileCheck /bitbucket/nlopes/llvm/llvm/test/Transforms/StraightLineStrengthReduce/NVPTX/reassociate-geps-and-slsr.ll