diff options
author | David Majnemer <david.majnemer@gmail.com> | 2015-06-06 04:56:51 +0000 |
---|---|---|
committer | David Majnemer <david.majnemer@gmail.com> | 2015-06-06 04:56:51 +0000 |
commit | 1c297e66fb839f574cfe2796acbcb8a499168259 (patch) | |
tree | 42816f8ae0041cdd6ad62481a5e41a68bd5850cb /llvm/lib/Transforms | |
parent | 743afa0736588cec9f189b3700cac57482af17cc (diff) | |
download | bcm5719-llvm-1c297e66fb839f574cfe2796acbcb8a499168259.tar.gz bcm5719-llvm-1c297e66fb839f574cfe2796acbcb8a499168259.zip |
[CVP] Don't assume Constants of type i1 can be known to be true or false
CVP wants to analyze the condition operand of a select along an edge.
It succeeds in getting back a Constant but not a ConstantInt. Instead,
it gets a ConstantExpr. It then assumes that the Constant must be equal
to false because it isn't equal to true.
Instead, perform an additional comparison.
This fixes PR23752.
llvm-svn: 239217
Diffstat (limited to 'llvm/lib/Transforms')
-rw-r--r-- | llvm/lib/Transforms/Scalar/CorrelatedValuePropagation.cpp | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/llvm/lib/Transforms/Scalar/CorrelatedValuePropagation.cpp b/llvm/lib/Transforms/Scalar/CorrelatedValuePropagation.cpp index d1302c6e22f..79624b2e4c4 100644 --- a/llvm/lib/Transforms/Scalar/CorrelatedValuePropagation.cpp +++ b/llvm/lib/Transforms/Scalar/CorrelatedValuePropagation.cpp @@ -113,10 +113,11 @@ bool CorrelatedValuePropagation::processPHI(PHINode *P) { Value *Condition = SI->getCondition(); if (!Condition->getType()->isVectorTy()) { - if (Constant *C = LVI->getConstantOnEdge(Condition, P->getIncomingBlock(i), BB, P)) { - if (C == ConstantInt::getTrue(Condition->getType())) { + if (Constant *C = LVI->getConstantOnEdge( + Condition, P->getIncomingBlock(i), BB, P)) { + if (C->isOneValue()) { V = SI->getTrueValue(); - } else { + } else if (C->isZeroValue()) { V = SI->getFalseValue(); } // Once LVI learns to handle vector types, we could also add support |