From 7e1084d36c80223405b82292fc4e1b21d44740d6 Mon Sep 17 00:00:00 2001 From: Nadav Rotem Date: Sun, 21 Oct 2012 02:38:01 +0000 Subject: [PATCH] Vectorizer: fix a bug in the classification of induction/reduction phis. llvm-svn: 166384 --- llvm/lib/Transforms/Vectorize/LoopVectorize.cpp | 3 +++ .../LoopVectorize/2012-10-20-infloop.ll | 15 +++++++++++++++ 2 files changed, 18 insertions(+) diff --git a/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp b/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp index 027fe0656be5..76936d52c992 100644 --- a/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp +++ b/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp @@ -950,6 +950,9 @@ bool LoopVectorizationLegality::canVectorizeBlock(BasicBlock &BB) { DEBUG(dbgs() << "LV: Found an Mult reduction PHI."<< *Phi <<"\n"); continue; } + + DEBUG(dbgs() << "LV: Found an unidentified PHI."<< *Phi <<"\n"); + return false; }// end of PHI handling // We still don't handle functions. diff --git a/llvm/test/Transforms/LoopVectorize/2012-10-20-infloop.ll b/llvm/test/Transforms/LoopVectorize/2012-10-20-infloop.ll index 16a77291995d..5caaffc8ddea 100644 --- a/llvm/test/Transforms/LoopVectorize/2012-10-20-infloop.ll +++ b/llvm/test/Transforms/LoopVectorize/2012-10-20-infloop.ll @@ -10,3 +10,18 @@ for.body: br label %for.body } + + +define void @test2() nounwind { +entry: + br label %for.body + +for.body: ; preds = %for.body, %entry + %indvars.iv47 = phi i64 [ 0, %entry ], [ %indvars.iv.next48, %for.body ] + %0 = phi i32 [ 1, %entry ], [ 0, %for.body ] + %indvars.iv.next48 = add i64 %indvars.iv47, 1 + br i1 undef, label %for.end, label %for.body + +for.end: ; preds = %for.body + unreachable +}