summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms
diff options
context:
space:
mode:
authorArnold Schwaighofer <aschwaighofer@apple.com>2013-05-18 18:38:34 +0000
committerArnold Schwaighofer <aschwaighofer@apple.com>2013-05-18 18:38:34 +0000
commit693a1ca6284f5145d261b390156507f12046d4c6 (patch)
treea0d4f06c01db7877cb21973820e6bc7dd3c2eda3 /llvm/lib/Transforms
parent836a4f36435a4984f733eca96bef187bb6ee992e (diff)
downloadbcm5719-llvm-693a1ca6284f5145d261b390156507f12046d4c6.tar.gz
bcm5719-llvm-693a1ca6284f5145d261b390156507f12046d4c6.zip
LoopVectorize: Handle single edge PHIs
We might encouter single edge PHIs - handle them with an identity select. Fixes PR15990. llvm-svn: 182199
Diffstat (limited to 'llvm/lib/Transforms')
-rw-r--r--llvm/lib/Transforms/Vectorize/LoopVectorize.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp b/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
index fce2cf211cd..d5c6ff8cad2 100644
--- a/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
+++ b/llvm/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.
OpenPOWER on IntegriCloud