diff options
author | Arnold Schwaighofer <aschwaighofer@apple.com> | 2013-05-18 18:38:34 +0000 |
---|---|---|
committer | Arnold Schwaighofer <aschwaighofer@apple.com> | 2013-05-18 18:38:34 +0000 |
commit | 688b5103eb4b70410d1ea54bcd8df4ef2f2ff8e8 (patch) | |
tree | 47e826e7f6429f59bfe43a2a4b6d6ee0e04ae7ff /lib/Transforms | |
parent | edc399acebc94cfa26b47a6d8d836e2e1a009420 (diff) | |
download | llvm-688b5103eb4b70410d1ea54bcd8df4ef2f2ff8e8.tar.gz llvm-688b5103eb4b70410d1ea54bcd8df4ef2f2ff8e8.tar.bz2 llvm-688b5103eb4b70410d1ea54bcd8df4ef2f2ff8e8.tar.xz |
LoopVectorize: Handle single edge PHIs
We might encouter single edge PHIs - handle them with an identity select.
Fixes PR15990.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@182199 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Transforms')
-rw-r--r-- | lib/Transforms/Vectorize/LoopVectorize.cpp | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/lib/Transforms/Vectorize/LoopVectorize.cpp b/lib/Transforms/Vectorize/LoopVectorize.cpp index fce2cf211c..d5c6ff8cad 100644 --- a/lib/Transforms/Vectorize/LoopVectorize.cpp +++ b/lib/Transforms/Vectorize/LoopVectorize.cpp @@ -2105,7 +2105,6 @@ InnerLoopVectorizer::vectorizeBlockInLoop(LoopVectorizationLegality *Legal, // optimizations will clean it up. unsigned NumIncoming = P->getNumIncomingValues(); - assert(NumIncoming > 1 && "Invalid PHI"); // Generate a sequence of selects of the form: // SELECT(Mask3, In3, @@ -2117,10 +2116,11 @@ InnerLoopVectorizer::vectorizeBlockInLoop(LoopVectorizationLegality *Legal, VectorParts &In0 = getVectorValue(P->getIncomingValue(In)); for (unsigned part = 0; part < UF; ++part) { - // We don't need to 'select' the first PHI operand because it is - // the default value if all of the other masks don't match. + // We might have single edge PHIs (blocks) - use an identity + // 'select' for the first PHI operand. if (In == 0) - Entry[part] = In0[part]; + Entry[part] = Builder.CreateSelect(Cond[part], In0[part], + In0[part]); else // Select between the current value and the previous incoming edge // based on the incoming mask. |