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 2a3f174788
commit 5652836d44

View File

@ -53,12 +53,9 @@ bool Constant::isNegativeZeroValue() const {
if (SplatCFP && SplatCFP->isZero() && SplatCFP->isNegative())
return true;
// However, vectors of zeroes which are floating point represent +0.0's.
if (const ConstantAggregateZero *CAZ = dyn_cast<ConstantAggregateZero>(this))
if (const VectorType *VT = dyn_cast<VectorType>(CAZ->getType()))
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;
// We've already handled true FP case; any other FP vectors can't represent -0.0.
if (getType()->isFPOrFPVectorTy())
return false;
// Otherwise, just use +0.0.
return isNullValue();