aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/llvm/Constants.h18
1 files changed, 16 insertions, 2 deletions
diff --git a/include/llvm/Constants.h b/include/llvm/Constants.h
index ec6345846e..6c1b8eb1e6 100644
--- a/include/llvm/Constants.h
+++ b/include/llvm/Constants.h
@@ -289,7 +289,14 @@ public:
/// isNullValue - Return true if this is the value that would be returned by
/// getNullValue.
- virtual bool isNullValue() const { return false; }
+ virtual bool isNullValue() const {
+ // FIXME: This should be made to be MUCH faster. Just check against well
+ // known null value!
+ for (unsigned i = 0, e = getNumOperands(); i != e; ++i)
+ if (!cast<Constant>(getOperand(i))->isNullValue())
+ return false;
+ return true;
+ }
virtual void destroyConstant();
virtual void replaceUsesOfWithOnConstant(Value *From, Value *To);
@@ -328,7 +335,14 @@ public:
/// isNullValue - Return true if this is the value that would be returned by
/// getNullValue.
- virtual bool isNullValue() const { return false; }
+ virtual bool isNullValue() const {
+ // FIXME: This should be made to be MUCH faster. Just check against well
+ // known null value!
+ for (unsigned i = 0, e = getNumOperands(); i != e; ++i)
+ if (!cast<Constant>(getOperand(i))->isNullValue())
+ return false;
+ return true;
+ }
virtual void destroyConstant();
virtual void replaceUsesOfWithOnConstant(Value *From, Value *To);