[LLVMbugs] [Bug 14725] New: loop vectorizer borks phi node
bugzilla-daemon at llvm.org
bugzilla-daemon at llvm.org
Wed Dec 26 22:28:45 PST 2012
http://llvm.org/bugs/show_bug.cgi?id=14725
Bug #: 14725
Summary: loop vectorizer borks phi node
Product: libraries
Version: trunk
Platform: PC
OS/Version: All
Status: NEW
Severity: enhancement
Priority: P
Component: Loop Optimizer
AssignedTo: unassignedbugs at nondot.org
ReportedBy: nlewycky at google.com
CC: llvmbugs at cs.uiuc.edu, nrotem at apple.com
Classification: Unclassified
This testcase causes "opt -loop-vectorizer -mtriple x86_64-unknown-linux-gnu"
to emit bad IR:
target datalayout =
"e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"
%type1 = type { %type2 }
%type2 = type { [0 x i8*], i8**, i32, i32, i32 }
define void @test() nounwind uwtable align 2 {
br label %for.body.lr.ph.i.i.i
for.body.lr.ph.i.i.i:
br label %for.body.i.i.i
for.body.i.i.i:
%indvars.iv = phi i64 [ %indvars.iv.next, %for.inc.i.i.i ], [ 0,
%for.body.lr\
.ph.i.i.i ]
br label %for.inc.i.i.i
for.inc.i.i.i:
%indvars.iv.next = add i64 %indvars.iv, 1
%lftr.wideiv = trunc i64 %indvars.iv.next to i32
%exitcond = icmp ne i32 %lftr.wideiv, undef
br i1 %exitcond, label %for.body.i.i.i, label %for.end.i.i.i
for.end.i.i.i:
%lcssa = phi %type1* [ undef, %for.inc.i.i.i ]
unreachable
}
The IR out of opt would fail the verifier. Here it is:
target datalayout =
"e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f3
target triple = "x86_64-unknown-linux-gnu"
%type1 = type { %type2 }
%type2 = type { [0 x i8*], i8**, i32, i32, i32 }
define void @test() nounwind uwtable align 2 {
br label %for.body.lr.ph.i.i.i
for.body.lr.ph.i.i.i: ; preds = %0
%zext.cnt = zext i32 undef to i64
%end.idx = add i64 %zext.cnt, 0
%n.mod.vf = urem i64 %zext.cnt, 8
%n.vec = sub i64 %zext.cnt, %n.mod.vf
%end.idx.rnd.down = add i64 %n.vec, 0
%cmp.zero = icmp eq i64 %end.idx.rnd.down, 0
br i1 %cmp.zero, label %middle.block, label %vector.ph
vector.ph: ; preds =
%for.body.lr.ph.i.i.
br label %vector.body
vector.body: ; preds = %vector.body,
%vecto
%index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
%1 = insertelement <8 x i64> undef, i64 %index, i32 0
%broadcast = shufflevector <8 x i64> %1, <8 x i64> undef, <8 x i32>
zeroinitia
%induction = add <8 x i64> %broadcast, <i64 0, i64 1, i64 2, i64 3, i64 4,
i64
%2 = add <8 x i64> %induction, <i64 1, i64 1, i64 1, i64 1, i64 1, i64 1, i64
%3 = trunc <8 x i64> %2 to <8 x i32>
%4 = icmp ne <8 x i32> %3, undef
%index.next = add i64 %index, 8
%5 = icmp eq i64 %index.next, %end.idx.rnd.down
br i1 %5, label %middle.block, label %vector.body
middle.block: ; preds = %vector.body,
%for.b
%resume.val = phi i64 [ 0, %for.body.lr.ph.i.i.i ], [ %end.idx.rnd.down,
%vect
%cmp.n = icmp eq i64 %end.idx, %resume.val
br i1 %cmp.n, label %for.end.i.i.i, label %scalar.ph
scalar.ph: ; preds = %middle.block
br label %for.body.i.i.i
for.body.i.i.i: ; preds = %for.inc.i.i.i,
%sca
%indvars.iv = phi i64 [ %indvars.iv.next, %for.inc.i.i.i ], [ %resume.val,
%sc
br label %for.inc.i.i.i
for.inc.i.i.i: ; preds = %for.body.i.i.i
%indvars.iv.next = add i64 %indvars.iv, 1
%lftr.wideiv = trunc i64 %indvars.iv.next to i32
%exitcond = icmp ne i32 %lftr.wideiv, undef
br i1 %exitcond, label %for.body.i.i.i, label %for.end.i.i.i
for.end.i.i.i: ; preds = %middle.block,
%for.
%lcssa = phi %type1* [ undef, %for.inc.i.i.i ]
unreachable
}
where the verifier error is right at the end on %lcssa, in the last BB:
PHINode should have one entry for each predecessor of its parent basic block!
%lcssa = phi %type1* [ undef, %for.inc.i.i.i ]
--
Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.
More information about the llvm-bugs
mailing list