diff options
author | Owen Anderson <resistor@mac.com> | 2015-11-20 08:16:13 +0000 |
---|---|---|
committer | Owen Anderson <resistor@mac.com> | 2015-11-20 08:16:13 +0000 |
commit | 630077ef558317ac85bfc266737040eaecd0bcb0 (patch) | |
tree | de32cd0ae4432959e87b9a995d5647df30ac4dad /llvm/lib/IR/Constants.cpp | |
parent | 7d0cc2378655423462e33aebb7f7cd13588734a9 (diff) | |
download | bcm5719-llvm-630077ef558317ac85bfc266737040eaecd0bcb0.tar.gz bcm5719-llvm-630077ef558317ac85bfc266737040eaecd0bcb0.zip |
Fix a pair of issues that caused an infinite loop in reassociate.
Terrifyingly, one of them is a mishandling of floating point vectors
in Constant::isZero(). How exactly this issue survived this long
is beyond me.
llvm-svn: 253655
Diffstat (limited to 'llvm/lib/IR/Constants.cpp')
-rw-r--r-- | llvm/lib/IR/Constants.cpp | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/llvm/lib/IR/Constants.cpp b/llvm/lib/IR/Constants.cpp index 550d9a89a65..b237c913dcf 100644 --- a/llvm/lib/IR/Constants.cpp +++ b/llvm/lib/IR/Constants.cpp @@ -68,6 +68,12 @@ bool Constant::isZeroValue() const { if (const ConstantFP *CFP = dyn_cast<ConstantFP>(this)) return CFP->isZero(); + // Equivalent for a vector of -0.0's. + if (const ConstantDataVector *CV = dyn_cast<ConstantDataVector>(this)) + if (ConstantFP *SplatCFP = dyn_cast_or_null<ConstantFP>(CV->getSplatValue())) + if (SplatCFP && SplatCFP->isZero()) + return true; + // Otherwise, just use +0.0. return isNullValue(); } |