Test Failure: Transforms/LoopVectorize/single-early-exit-cond-poison.ll

Test source: git

Log:

Source: /bitbucket/nlopes/llvm/llvm/test/Transforms/LoopVectorize/single-early-exit-cond-poison.ll
-- 1. ModuleToFunctionPassAdaptor
-- 1. PassManager<Function> : Skipping NOP
-- 2. LoopVectorizePass

----------------------------------------
define i32 @f(i32 noundef %g) noundef {
entry:
  br label %loop.header

loop.header:
  %iv = phi i32 [ 0, %entry ], [ %iv.next, %loop.latch ]
  %mul = shl nsw nuw i32 %iv, 3
  %shr = ashr i32 noundef %g, %mul
  %early.cond = icmp eq i32 %shr, 0
  br i1 %early.cond, label %loop.latch, label %return

loop.latch:
  %iv.next = add nsw nuw i32 %iv, 1
  %ec = icmp eq i32 %iv.next, 8
  br i1 %ec, label %return, label %loop.header

return:
  %res = phi i32 [ %shr, %loop.latch ], [ %iv, %loop.header ]
  ret i32 %res
}
Transformation seems to be correct! (syntactically equal)

-- 3. LoopVectorizePass

----------------------------------------
define i32 @f(i32 noundef %g) noundef {
entry:
  br label %loop.header

loop.header:
  %iv = phi i32 [ 0, %entry ], [ %iv.next, %loop.latch ]
  %mul = shl nsw nuw i32 %iv, 3
  %shr = ashr i32 noundef %g, %mul
  %early.cond = icmp eq i32 %shr, 0
  br i1 %early.cond, label %loop.latch, label %return

loop.latch:
  %iv.next = add nsw nuw i32 %iv, 1
  %ec = icmp eq i32 %iv.next, 8
  br i1 %ec, label %return, label %loop.header

return:
  %res = phi i32 [ %shr, %loop.latch ], [ %iv, %loop.header ]
  ret i32 %res
}
=>
declare i64 @llvm.experimental.cttz.elts.i64.v4i1(<4 x i1>, i1) nofree willreturn memory(none)

define i32 @f(i32 noundef %g) noundef {
entry:
  br i1 0, label %scalar.ph, label %vector.ph

vector.ph:
  %broadcast.splatinsert = insertelement <4 x i32> poison, i32 noundef %g, i64 0
  %broadcast.splat = shufflevector <4 x i32> %broadcast.splatinsert, <4 x i32> poison, 0, 0, 0, 0
  br label %vector.body

vector.body:
  %index = phi i32 [ 0, %vector.ph ], [ %index.next, %vector.body ]
  %vec.ind = phi <4 x i32> [ { 0, 1, 2, 3 }, %vector.ph ], [ %vec.ind.next, %vector.body ]
  %step.add = add <4 x i32> %vec.ind, { 4, 4, 4, 4 }
  %#0 = shl nsw nuw <4 x i32> %vec.ind, { 3, 3, 3, 3 }
  %#1 = shl nsw nuw <4 x i32> %step.add, { 3, 3, 3, 3 }
  %#2 = ashr <4 x i32> %broadcast.splat, %#0
  %#3 = ashr <4 x i32> %broadcast.splat, %#1
  %#4 = icmp ne <4 x i32> %#2, { 0, 0, 0, 0 }
  %#5 = icmp ne <4 x i32> %#3, { 0, 0, 0, 0 }
  %index.next = add nuw i32 %index, 8
  %#6 = or <4 x i1> %#4, %#5
  %#7 = reduce_or <4 x i1> %#6
  %vec.ind.next = add <4 x i32> %step.add, { 4, 4, 4, 4 }
  br i1 1, label %middle.split, label %vector.body

middle.split:
  %#8 = extractelement <4 x i32> %#3, i32 3
  br i1 %#7, label %vector.early.exit, label %middle.block

vector.early.exit:
  %#9 = call i64 @llvm.experimental.cttz.elts.i64.v4i1(<4 x i1> %#5, i1 1) nofree willreturn memory(none)
  %#10 = add i64 4, %#9
  %#11 = call i64 @llvm.experimental.cttz.elts.i64.v4i1(<4 x i1> %#4, i1 1) nofree willreturn memory(none)
  %#12 = add i64 0, %#11
  %#13 = icmp ne i64 %#11, 4
  %#14 = select i1 %#13, i64 %#12, i64 %#10
  %#15 = trunc i64 %#14 to i32
  %#16 = add i32 %index, %#15
  br label %return

middle.block:
  br label %return

scalar.ph:
  br label %loop.header

loop.header:
  %iv = phi i32 [ 0, %scalar.ph ], [ %iv.next, %loop.latch ]
  %mul = shl nsw nuw i32 %iv, 3
  %shr = ashr i32 noundef %g, %mul
  %early.cond = icmp eq i32 %shr, 0
  br i1 %early.cond, label %loop.latch, label %return

loop.latch:
  %iv.next = add nsw nuw i32 %iv, 1
  %ec = icmp eq i32 %iv.next, 8
  br i1 %ec, label %return, label %loop.header

return:
  %res = phi i32 [ %shr, %loop.latch ], [ %iv, %loop.header ], [ %#8, %middle.block ], [ %#16, %vector.early.exit ]
  ret i32 %res
}
Transformation doesn't verify! (unsound)
ERROR: Source is more defined than target

Example:
i32 noundef %g = #x00000001 (1)

Source:
  >> Jump to %loop.header
i32 %iv = #x00000000 (0)
i32 %mul = #x00000000 (0)
i32 %shr = #x00000001 (1)
i1 %early.cond = #x0 (0)
  >> Jump to %return
i32 %res = #x00000000 (0)

SOURCE MEMORY STATE
===================
NON-LOCAL BLOCKS:
Block 0 >	size: 0	align: 1	alloc type: 0	alive: false	address: 0

Target:
  >> Jump to %vector.ph
<4 x i32> %broadcast.splatinsert = < #x00000001 (1), poison, poison, poison >
<4 x i32> %broadcast.splat = < #x00000001 (1), #x00000001 (1), #x00000001 (1), #x00000001 (1) >
  >> Jump to %vector.body
i32 %index = #x00000000 (0)
<4 x i32> %vec.ind = < #x00000000 (0), #x00000001 (1), #x00000002 (2), #x00000003 (3) >
<4 x i32> %step.add = < #x00000004 (4), #x00000005 (5), #x00000006 (6), #x00000007 (7) >
<4 x i32> %#0 = < #x00000000 (0), #x00000008 (8), #x00000010 (16), #x00000018 (24) >
<4 x i32> %#1 = < #x00000020 (32), #x00000028 (40), #x00000030 (48), #x00000038 (56) >
<4 x i32> %#2 = < #x00000001 (1), #x00000000 (0), #x00000000 (0), #x00000000 (0) >
<4 x i32> %#3 = < poison, poison, poison, poison >
<4 x i1> %#4 = < #x1 (1), #x0 (0), #x0 (0), #x0 (0) >
<4 x i1> %#5 = < poison, poison, poison, poison >
i32 %index.next = #x00000008 (8)
<4 x i1> %#6 = < poison, poison, poison, poison >
i1 %#7 = poison
<4 x i32> %vec.ind.next = < #x00000008 (8), #x00000009 (9), #x0000000a (10), #x0000000b (11) >
  >> Jump to %middle.split
i32 %#8 = poison
UB triggered on br


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' '-p' 'loop-vectorize' '-force-vector-width=4' '-force-vector-interleave=2' '-S' '/bitbucket/nlopes/llvm/llvm/test/Transforms/LoopVectorize/single-early-exit-cond-poison.ll' '-tv-smt-to=20000' '-tv-report-dir=/home/nlopes/alive2/build/logs' '-tv-smt-stats'
Wrote bitcode to: "/home/nlopes/alive2/build/logs/single-early-exit-cond-poison_zl33CwoV_ZY3D.bc"


------------------- SMT STATS -------------------
Num queries: 9
Num invalid: 0
Num skips:   0
Num trivial: 41 (82.0%)
Num timeout: 0 (0.0%)
Num errors:  0 (0.0%)
Num SAT:     8 (88.9%)
Num UNSAT:   1 (11.1%)
Alive2: Transform doesn't verify; aborting!

stderr:

/home/nlopes/alive2/build/opt-alive.sh -p loop-vectorize -force-vector-width=4 -force-vector-interleave=2 -S /bitbucket/nlopes/llvm/llvm/test/Transforms/LoopVectorize/single-early-exit-cond-poison.ll | /bitbucket/nlopes/llvm/build/bin/FileCheck --check-prefix=VF4IC2 /bitbucket/nlopes/llvm/llvm/test/Transforms/LoopVectorize/single-early-exit-cond-poison.ll # RUN: at line 2
+ /home/nlopes/alive2/build/opt-alive.sh -p loop-vectorize -force-vector-width=4 -force-vector-interleave=2 -S /bitbucket/nlopes/llvm/llvm/test/Transforms/LoopVectorize/single-early-exit-cond-poison.ll
+ /bitbucket/nlopes/llvm/build/bin/FileCheck --check-prefix=VF4IC2 /bitbucket/nlopes/llvm/llvm/test/Transforms/LoopVectorize/single-early-exit-cond-poison.ll

FileCheck error: '<stdin>' is empty.
FileCheck command line:  /bitbucket/nlopes/llvm/build/bin/FileCheck --check-prefix=VF4IC2 /bitbucket/nlopes/llvm/llvm/test/Transforms/LoopVectorize/single-early-exit-cond-poison.ll

 

<-- Back