diff options
author | Jinsong Ji <jji@us.ibm.com> | 2021-06-03 20:08:35 +0000 |
---|---|---|
committer | Jinsong Ji <jji@us.ibm.com> | 2021-06-03 20:31:01 +0000 |
commit | cd9e1a020cf0902e79ae1178cc4b93f5c5ce9381 (patch) | |
tree | d71774a895a14a1094204cf5a651c6727fb687d8 /llvm/lib/IR/Constants.cpp | |
parent | a14fc749aab2c8e1a45d19d512255ebfc69357c3 (diff) | |
download | llvm-cd9e1a020cf0902e79ae1178cc4b93f5c5ce9381.zip llvm-cd9e1a020cf0902e79ae1178cc4b93f5c5ce9381.tar.gz llvm-cd9e1a020cf0902e79ae1178cc4b93f5c5ce9381.tar.bz2 |
[Constants][PowerPC] Check exactlyValue for ppc_fp128 in isNullValue
PPC_FP128 determines isZero/isNan/isInf using high-order double value
only. Checking isZero/isNegative might return the isNullValue unexpectedly.
eg:
0xM0000000000000000FFFFFFFFFFFFFFFFF
isZero, but it is not NullValue.
Reviewed By: efriedma
Differential Revision: https://reviews.llvm.org/D103634
Diffstat (limited to 'llvm/lib/IR/Constants.cpp')
-rw-r--r-- | llvm/lib/IR/Constants.cpp | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/llvm/lib/IR/Constants.cpp b/llvm/lib/IR/Constants.cpp index 54b0a7d..c3134dc 100644 --- a/llvm/lib/IR/Constants.cpp +++ b/llvm/lib/IR/Constants.cpp @@ -90,7 +90,9 @@ bool Constant::isNullValue() const { // +0.0 is null. if (const ConstantFP *CFP = dyn_cast<ConstantFP>(this)) - return CFP->isZero() && !CFP->isNegative(); + // ppc_fp128 determine isZero using high order double only + // Should check the bitwise value to make sure all bits are zero. + return CFP->isExactlyValue(+0.0); // constant zero is zero for aggregates, cpnull is null for pointers, none for // tokens. |