Test Failure: Transforms/LoopVectorize/runtime-check.ll

Test source: git

Comments: Bug in IR semantics or optimization: escapes noescape pointer

Log:

Source: <stdin>
-- 1. ModuleToFunctionPassAdaptor
ERROR: Unsupported attribute: noalias
-- 1. PassManager<Function> : Skipping NOP
-- 2. LoopVectorizePass

----------------------------------------
define i32 @foo(ptr nocapture %a, ptr nocapture %b, i32 %n) {
entry:
  %cmp6 = icmp sgt i32 %n, 0
  br i1 %cmp6, label %for.body, label %for.end

for.body:
  %indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
  %arrayidx = gep inbounds ptr nocapture %b, 4 x i64 %indvars.iv
  %#0 = load float, ptr %arrayidx, align 4
  %mul = fmul float %#0, 3.000000
  %arrayidx2 = gep inbounds ptr nocapture %a, 4 x i64 %indvars.iv
  store float %mul, ptr %arrayidx2, align 4
  %indvars.iv.next = add i64 %indvars.iv, 1
  %lftr.wideiv = trunc i64 %indvars.iv.next to i32
  %exitcond = icmp eq i32 %lftr.wideiv, %n
  br i1 %exitcond, label %for.end, label %for.body

for.end:
  ret i32 undef
}
Transformation seems to be correct! (syntactically equal)

-- 3. LoopVectorizePass

----------------------------------------
define i32 @foo(ptr nocapture %a, ptr nocapture %b, i32 %n) {
entry:
  %cmp6 = icmp sgt i32 %n, 0
  br i1 %cmp6, label %for.body, label %for.end

for.body:
  %indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
  %arrayidx = gep inbounds ptr nocapture %b, 4 x i64 %indvars.iv
  %#0 = load float, ptr %arrayidx, align 4
  %mul = fmul float %#0, 3.000000
  %arrayidx2 = gep inbounds ptr nocapture %a, 4 x i64 %indvars.iv
  store float %mul, ptr %arrayidx2, align 4
  %indvars.iv.next = add i64 %indvars.iv, 1
  %lftr.wideiv = trunc i64 %indvars.iv.next to i32
  %exitcond = icmp eq i32 %lftr.wideiv, %n
  br i1 %exitcond, label %for.end, label %for.body

for.end:
  ret i32 undef
}
=>
define i32 @foo(ptr nocapture %a, ptr nocapture %b, i32 %n) {
entry:
  %b2 = ptrtoint ptr nocapture %b to i64
  %a1 = ptrtoint ptr nocapture %a to i64
  %cmp6 = icmp sgt i32 %n, 0
  br i1 %cmp6, label %for.body.preheader, label %for.end

for.body.preheader:
  %#0 = zext i32 %n to i64
  %min.iters.check = icmp ult i64 %#0, 4
  br i1 %min.iters.check, label %scalar.ph, label %vector.memcheck

vector.memcheck:
  %#1 = sub i64 %a1, %b2
  %diff.check = icmp ult i64 %#1, 16
  br i1 %diff.check, label %scalar.ph, label %vector.ph

vector.ph:
  %n.mod.vf = urem i64 %#0, 4
  %n.vec = sub i64 %#0, %n.mod.vf
  br label %vector.body

vector.body:
  %index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
  %#2 = add i64 %index, 0
  %#3 = gep inbounds ptr nocapture %b, 4 x i64 %#2
  %#4 = gep inbounds ptr %#3, 4 x i32 0
  %wide.load = load <4 x float>, ptr %#4, align 4
  %#5 = fmul <4 x float> %wide.load, { 3.000000, 3.000000, 3.000000, 3.000000 }
  %#6 = gep inbounds ptr nocapture %a, 4 x i64 %#2
  %#7 = gep inbounds ptr %#6, 4 x i32 0
  store <4 x float> %#5, ptr %#7, align 4
  %index.next = add nuw i64 %index, 4
  %#8 = icmp eq i64 %index.next, %n.vec
  br i1 %#8, label %middle.block, label %vector.body

middle.block:
  %cmp.n = icmp eq i64 %#0, %n.vec
  br i1 %cmp.n, label %for.end.loopexit, label %scalar.ph

scalar.ph:
  %bc.resume.val = phi i64 [ %n.vec, %middle.block ], [ 0, %for.body.preheader ], [ 0, %vector.memcheck ]
  br label %for.body

for.body:
  %indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ %bc.resume.val, %scalar.ph ]
  %arrayidx = gep inbounds ptr nocapture %b, 4 x i64 %indvars.iv
  %#9 = load float, ptr %arrayidx, align 4
  %mul = fmul float %#9, 3.000000
  %arrayidx2 = gep inbounds ptr nocapture %a, 4 x i64 %indvars.iv
  store float %mul, ptr %arrayidx2, align 4
  %indvars.iv.next = add i64 %indvars.iv, 1
  %lftr.wideiv = trunc i64 %indvars.iv.next to i32
  %exitcond = icmp eq i32 %lftr.wideiv, %n
  br i1 %exitcond, label %for.end.loopexit, label %for.body

for.end.loopexit:
  br label %for.end

for.end:
  ret i32 undef
}
Transformation doesn't verify! (unsound)
ERROR: Source is more defined than target

Example:
ptr nocapture %a = poison
ptr nocapture %b = poison
i32 %n = #x00000000 (0)

Source:
i1 %cmp6 = #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: 5	align: 8	alloc type: 0	alive: true	address: 8
Block 2 >	size: 1	align: 1	alloc type: 0	alive: true	address: 4

Target:
i64 %b2 = UB triggered!


Pass: LoopVectorizePass
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' '-aa-pipeline=basic-aa' '-passes=loop-vectorize,dce,instcombine' '-force-vector-interleave=1' '-force-vector-width=4' '-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_UKeaDY0S_oMnG.bc"


------------------- SMT STATS -------------------
Num queries: 32
Num invalid: 0
Num skips:   0
Num trivial: 2 (5.9%)
Num timeout: 0 (0.0%)
Num errors:  0 (0.0%)
Num SAT:     26 (81.2%)
Num UNSAT:   6 (18.8%)
Alive2: Transform doesn't verify; aborting!

stderr:

RUN: at line 2: /home/nlopes/alive2/build/opt-alive.sh < /bitbucket/nlopes/llvm/llvm/test/Transforms/LoopVectorize/runtime-check.ll -aa-pipeline=basic-aa -passes=loop-vectorize,dce,instcombine -force-vector-interleave=1 -force-vector-width=4  -S | /bitbucket/nlopes/llvm/build/bin/FileCheck /bitbucket/nlopes/llvm/llvm/test/Transforms/LoopVectorize/runtime-check.ll
+ /home/nlopes/alive2/build/opt-alive.sh -aa-pipeline=basic-aa -passes=loop-vectorize,dce,instcombine -force-vector-interleave=1 -force-vector-width=4 -S
+ /bitbucket/nlopes/llvm/build/bin/FileCheck /bitbucket/nlopes/llvm/llvm/test/Transforms/LoopVectorize/runtime-check.ll

FileCheck error: '<stdin>' is empty.
FileCheck command line:  /bitbucket/nlopes/llvm/build/bin/FileCheck /bitbucket/nlopes/llvm/llvm/test/Transforms/LoopVectorize/runtime-check.ll

 

<-- Back