The testing to ensure a vector of zeros of type floating point isn't misclassified as negative zero can be simplified, as pointed out by Duncan Sands.

llvm-svn: 177386
This commit is contained in:
David Tweed 2013-03-19 10:16:40 +00:00
parent ffb4ca8bb4
commit 298e4192ea
1 changed files with 3 additions and 6 deletions

View File

@ -53,12 +53,9 @@ bool Constant::isNegativeZeroValue() const {
if (SplatCFP && SplatCFP->isZero() && SplatCFP->isNegative()) if (SplatCFP && SplatCFP->isZero() && SplatCFP->isNegative())
return true; return true;
// However, vectors of zeroes which are floating point represent +0.0's. // We've already handled true FP case; any other FP vectors can't represent -0.0.
if (const ConstantAggregateZero *CAZ = dyn_cast<ConstantAggregateZero>(this)) if (getType()->isFPOrFPVectorTy())
if (const VectorType *VT = dyn_cast<VectorType>(CAZ->getType())) return false;
if (VT->getElementType()->isFloatingPointTy())
// As it's a CAZ, we know it's the zero bit-pattern (ie, +0.0) in each element.
return false;
// Otherwise, just use +0.0. // Otherwise, just use +0.0.
return isNullValue(); return isNullValue();