Test source: git
Source: <stdin>
-- 1. ModuleToFunctionPassAdaptor
-- 1. PassManager<Function> : Skipping NOP
-- 2. InstCombinePass
----------------------------------------
define void @test1(ptr %a, ptr noread nowrite %a_end, ptr %b.i) {
entry:
%cmp1 = icmp ult ptr %a, noread nowrite %a_end
br i1 %cmp1, label %for.body.preheader, label %for.end
for.body.preheader:
%b = ptrtoint ptr %b.i to i64
br label %for.body
for.body:
%a.addr.03 = phi ptr [ %incdec.ptr, %for.body ], [ %a, %for.body.preheader ]
%b.addr.02 = phi i64 [ %add.int, %for.body ], [ %b, %for.body.preheader ]
%tmp = int2ptr i64 %b.addr.02 to ptr
%tmp1 = load float, ptr %tmp, align 4
%mul.i = fmul float %tmp1, 42.000000
store float %mul.i, ptr %a.addr.03, align 4
%add = gep inbounds ptr %tmp, 4 x i64 1
%add.int = ptrtoint ptr %add to i64
%incdec.ptr = gep inbounds ptr %a.addr.03, 4 x i64 1
%cmp = icmp ult ptr %incdec.ptr, noread nowrite %a_end
br i1 %cmp, label %for.body, label %for.end
for.end:
ret void
}
Transformation seems to be correct! (syntactically equal)
-- 3. InstCombinePass
----------------------------------------
define void @test1(ptr %a, ptr noread nowrite %a_end, ptr %b.i) {
entry:
%cmp1 = icmp ult ptr %a, noread nowrite %a_end
br i1 %cmp1, label %for.body.preheader, label %for.end
for.body.preheader:
%b = ptrtoint ptr %b.i to i64
br label %for.body
for.body:
%a.addr.03 = phi ptr [ %incdec.ptr, %for.body ], [ %a, %for.body.preheader ]
%b.addr.02 = phi i64 [ %add.int, %for.body ], [ %b, %for.body.preheader ]
%tmp = int2ptr i64 %b.addr.02 to ptr
%tmp1 = load float, ptr %tmp, align 4
%mul.i = fmul float %tmp1, 42.000000
store float %mul.i, ptr %a.addr.03, align 4
%add = gep inbounds ptr %tmp, 4 x i64 1
%add.int = ptrtoint ptr %add to i64
%incdec.ptr = gep inbounds ptr %a.addr.03, 4 x i64 1
%cmp = icmp ult ptr %incdec.ptr, noread nowrite %a_end
br i1 %cmp, label %for.body, label %for.end
for.end:
ret void
}
=>
define void @test1(ptr %a, ptr noread nowrite %a_end, ptr %b.i) {
entry:
%cmp1 = icmp ult ptr %a, noread nowrite %a_end
br i1 %cmp1, label %for.body.preheader, label %for.end
for.body.preheader:
br label %for.body
for.body:
%a.addr.03 = phi ptr [ %incdec.ptr, %for.body ], [ %a, %for.body.preheader ]
%b.addr.02.in = phi ptr [ %add, %for.body ], [ %b.i, %for.body.preheader ]
%tmp1 = load float, ptr %b.addr.02.in, align 4
%mul.i = fmul float %tmp1, 42.000000
store float %mul.i, ptr %a.addr.03, align 4
%add = gep inbounds nuw ptr %b.addr.02.in, 1 x i64 4
%incdec.ptr = gep inbounds nuw ptr %a.addr.03, 1 x i64 4
%cmp = icmp ult ptr %incdec.ptr, noread nowrite %a_end
br i1 %cmp, label %for.body, label %for.end
for.end:
ret void
}
WARNING: slow vcgen! Took 80.44 s
Transformation doesn't verify! (unsound)
ERROR: Source is more defined than target
Example:
ptr %a = pointer(non-local, block_id=1, offset=8) / Address=#x000000000000000c
ptr noread nowrite %a_end = pointer(non-local, block_id=0, offset=13, attrs=3) / Address=#x000000000000000d
ptr %b.i = pointer(non-local, block_id=0, offset=4) / Address=#x0000000000000004
Source:
i1 %cmp1 = #x1 (1)
>> Jump to %for.body.preheader
i64 %b = #x0000000000000004 (4)
>> Jump to %for.body
ptr %a.addr.03 = pointer(non-local, block_id=1, offset=8) / Address=#x000000000000000c
i64 %b.addr.02 = #x0000000000000004 (4)
ptr %tmp = phy-ptr(addr=4) / Address=#x0000000000000004
float %tmp1 = poison
float %mul.i = poison
ptr %add = poison
i64 %add.int = poison
ptr %incdec.ptr = pointer(non-local, block_id=1, offset=12) / Address=#x0000000000000010
i1 %cmp = #x0 (0)
>> Jump to %for.end
SOURCE MEMORY STATE
===================
NON-LOCAL BLOCKS:
Block 0 > size: 0 align: 4 alloc type: 0 alive: false address: 0
Block 1 > size: 15 align: 4 alloc type: 0 alive: true address: 4
Block 2 > size: 0 align: 1 alloc type: 0 alive: true address: 1
Block 3 > size: 0 align: 1 alloc type: 0 alive: true address: 2
Block 4 > size: 0 align: 1 alloc type: 0 alive: true address: 1
Target:
i1 %cmp1 = #x1 (1)
>> Jump to %for.body.preheader
>> Jump to %for.body
ptr %a.addr.03 = pointer(non-local, block_id=1, offset=8) / Address=#x000000000000000c
ptr %b.addr.02.in = pointer(non-local, block_id=0, offset=4) / Address=#x0000000000000004
float %tmp1 = UB triggered!
Pass: InstCombinePass
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=instcombine' '-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_7y5Ry9hN_IVCf.bc"
------------------- SMT STATS -------------------
Num queries: 53
Num invalid: 0
Num skips: 0
Num trivial: 13 (19.7%)
Num timeout: 4 (7.5%)
Num errors: 0 (0.0%)
Num SAT: 39 (73.6%)
Num UNSAT: 10 (18.9%)
Alive2: Transform doesn't verify; aborting!
/home/nlopes/alive2/build/opt-alive.sh < /bitbucket/nlopes/llvm/llvm/test/Transforms/InstCombine/intptr2.ll -passes=instcombine -S | /bitbucket/nlopes/llvm/build/bin/FileCheck /bitbucket/nlopes/llvm/llvm/test/Transforms/InstCombine/intptr2.ll # RUN: at line 2 + /home/nlopes/alive2/build/opt-alive.sh -passes=instcombine -S + /bitbucket/nlopes/llvm/build/bin/FileCheck /bitbucket/nlopes/llvm/llvm/test/Transforms/InstCombine/intptr2.ll FileCheck error: '<stdin>' is empty. FileCheck command line: /bitbucket/nlopes/llvm/build/bin/FileCheck /bitbucket/nlopes/llvm/llvm/test/Transforms/InstCombine/intptr2.ll