[llvm-commits] [llvm] r166379 - in /llvm/trunk: lib/Transforms/Vectorize/LoopVectorize.cpp test/Transforms/LoopVectorize/2012-10-20-infloop.ll
Nadav Rotem
nrotem at apple.com
Sat Oct 20 13:45:01 PDT 2012
Author: nadav
Date: Sat Oct 20 15:45:01 2012
New Revision: 166379
URL: http://llvm.org/viewvc/llvm-project?rev=166379&view=rev
Log:
Fix an infinite loop in the loop-vectorizer.
PR14134.
Added:
llvm/trunk/test/Transforms/LoopVectorize/2012-10-20-infloop.ll
Modified:
llvm/trunk/lib/Transforms/Vectorize/LoopVectorize.cpp
Modified: llvm/trunk/lib/Transforms/Vectorize/LoopVectorize.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Vectorize/LoopVectorize.cpp?rev=166379&r1=166378&r2=166379&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/Vectorize/LoopVectorize.cpp (original)
+++ llvm/trunk/lib/Transforms/Vectorize/LoopVectorize.cpp Sat Oct 20 15:45:01 2012
@@ -1175,6 +1175,12 @@
bool FoundInBlockUser = false;
// Did we reach the initial PHI node ?
bool FoundStartPHI = false;
+
+ // If the instruction has no users then this is a broken
+ // chain and can't be a reduction variable.
+ if (Iter->use_begin() == Iter->use_end())
+ return false;
+
// For each of the *users* of iter.
for (Value::use_iterator it = Iter->use_begin(), e = Iter->use_end();
it != e; ++it) {
Added: llvm/trunk/test/Transforms/LoopVectorize/2012-10-20-infloop.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/LoopVectorize/2012-10-20-infloop.ll?rev=166379&view=auto
==============================================================================
--- llvm/trunk/test/Transforms/LoopVectorize/2012-10-20-infloop.ll (added)
+++ llvm/trunk/test/Transforms/LoopVectorize/2012-10-20-infloop.ll Sat Oct 20 15:45:01 2012
@@ -0,0 +1,12 @@
+; RUN: opt < %s -loop-vectorize -dce
+
+; Check that we don't fall into an infinite loop.
+define void @test() nounwind {
+entry:
+ br label %for.body
+
+for.body:
+ %0 = phi i32 [ 1, %entry ], [ 0, %for.body ]
+ br label %for.body
+}
+
More information about the llvm-commits
mailing list