summaryrefslogtreecommitdiffstats
path: root/lib/Transforms
diff options
context:
space:
mode:
authorNadav Rotem <nrotem@apple.com>2012-10-20 20:45:01 +0000
committerNadav Rotem <nrotem@apple.com>2012-10-20 20:45:01 +0000
commitccaccfa8bf070b169847109513610cf41abfd1f3 (patch)
tree81157fa84d2bbb85339e89e44d17d5d848543c36 /lib/Transforms
parentb8f2d82403bd059d26c091ec1ad3512033074546 (diff)
downloadexternal_llvm-ccaccfa8bf070b169847109513610cf41abfd1f3.zip
external_llvm-ccaccfa8bf070b169847109513610cf41abfd1f3.tar.gz
external_llvm-ccaccfa8bf070b169847109513610cf41abfd1f3.tar.bz2
Fix an infinite loop in the loop-vectorizer.
PR14134. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@166379 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Transforms')
-rw-r--r--lib/Transforms/Vectorize/LoopVectorize.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/lib/Transforms/Vectorize/LoopVectorize.cpp b/lib/Transforms/Vectorize/LoopVectorize.cpp
index c11c66f..027fe06 100644
--- a/lib/Transforms/Vectorize/LoopVectorize.cpp
+++ b/lib/Transforms/Vectorize/LoopVectorize.cpp
@@ -1175,6 +1175,12 @@ bool LoopVectorizationLegality::AddReductionVar(PHINode *Phi,
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) {