diff options
author | Owen Anderson <resistor@mac.com> | 2015-11-20 22:34:48 +0000 |
---|---|---|
committer | Owen Anderson <resistor@mac.com> | 2015-11-20 22:34:48 +0000 |
commit | 8e85130bb976c28ee0672586c2decaf315e9d153 (patch) | |
tree | 7cd60024ec7bae550c3dedc208c03edd724e9323 /llvm/lib/IR/Constants.cpp | |
parent | 5256fcada0ae3021b30bd1edc064beeffd0e41fc (diff) | |
download | bcm5719-llvm-8e85130bb976c28ee0672586c2decaf315e9d153.tar.gz bcm5719-llvm-8e85130bb976c28ee0672586c2decaf315e9d153.zip |
Fix another infinite loop in Reassociate caused by Constant::isZero().
Not all zero vectors are ConstantDataVector's.
llvm-svn: 253723
Diffstat (limited to 'llvm/lib/IR/Constants.cpp')
-rw-r--r-- | llvm/lib/IR/Constants.cpp | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/llvm/lib/IR/Constants.cpp b/llvm/lib/IR/Constants.cpp index b237c913dcf..d79fb3e7b0b 100644 --- a/llvm/lib/IR/Constants.cpp +++ b/llvm/lib/IR/Constants.cpp @@ -53,6 +53,11 @@ bool Constant::isNegativeZeroValue() const { if (SplatCFP && SplatCFP->isZero() && SplatCFP->isNegative()) return true; + if (const ConstantVector *CV = dyn_cast<ConstantVector>(this)) + if (ConstantFP *SplatCFP = dyn_cast_or_null<ConstantFP>(CV->getSplatValue())) + if (SplatCFP && SplatCFP->isZero() && SplatCFP->isNegative()) + return true; + // We've already handled true FP case; any other FP vectors can't represent -0.0. if (getType()->isFPOrFPVectorTy()) return false; @@ -74,6 +79,11 @@ bool Constant::isZeroValue() const { if (SplatCFP && SplatCFP->isZero()) return true; + if (const ConstantVector *CV = dyn_cast<ConstantVector>(this)) + if (ConstantFP *SplatCFP = dyn_cast_or_null<ConstantFP>(CV->getSplatValue())) + if (SplatCFP && SplatCFP->isZero()) + return true; + // Otherwise, just use +0.0. return isNullValue(); } |