diff options
author | Chris Lattner <sabre@nondot.org> | 2011-07-15 05:58:04 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2011-07-15 05:58:04 +0000 |
commit | b447387726ff94ddb2a23408f39e22714c42f79b (patch) | |
tree | 0025f862364fb3bd08c5de1a9d415280bef1e950 /lib/VMCore | |
parent | ba3ddf391f5149b8fca073adc3cbca361353929c (diff) | |
download | external_llvm-b447387726ff94ddb2a23408f39e22714c42f79b.zip external_llvm-b447387726ff94ddb2a23408f39e22714c42f79b.tar.gz external_llvm-b447387726ff94ddb2a23408f39e22714c42f79b.tar.bz2 |
add CFP::isNegative() and ConstnatInt::isNegative() methods.
Devirtualize the isNegativeZeroValue method.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@135249 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/VMCore')
-rw-r--r-- | lib/VMCore/Constants.cpp | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/lib/VMCore/Constants.cpp b/lib/VMCore/Constants.cpp index c043a8a..019a590 100644 --- a/lib/VMCore/Constants.cpp +++ b/lib/VMCore/Constants.cpp @@ -40,6 +40,15 @@ using namespace llvm; // Constant Class //===----------------------------------------------------------------------===// +bool Constant::isNegativeZeroValue() const { + // Floating point values have an explicit -0.0 value. + if (const ConstantFP *CFP = dyn_cast<ConstantFP>(this)) + return CFP->isZero() && CFP->isNegative(); + + // Otherwise, just use +0.0. + return isNullValue(); +} + // Constructor to create a '0' constant of arbitrary type... Constant *Constant::getNullValue(const Type *Ty) { switch (Ty->getTypeID()) { |