summaryrefslogtreecommitdiff
path: root/llvm/include/llvm/IR/Constant.h
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/include/llvm/IR/Constant.h')
-rw-r--r--llvm/include/llvm/IR/Constant.h18
1 files changed, 14 insertions, 4 deletions
diff --git a/llvm/include/llvm/IR/Constant.h b/llvm/include/llvm/IR/Constant.h
index 2b6a6e4141b9..174e7364c524 100644
--- a/llvm/include/llvm/IR/Constant.h
+++ b/llvm/include/llvm/IR/Constant.h
@@ -53,6 +53,10 @@ public:
/// Returns true if the value is one.
bool isOneValue() const;
+ /// Return true if the value is not the one value, or,
+ /// for vectors, does not contain one value elements.
+ bool isNotOneValue() const;
+
/// Return true if this is the value that would be returned by
/// getAllOnesValue.
bool isAllOnesValue() const;
@@ -64,7 +68,8 @@ public:
/// Return true if the value is negative zero or null value.
bool isZeroValue() const;
- /// Return true if the value is not the smallest signed value.
+ /// Return true if the value is not the smallest signed value, or,
+ /// for vectors, does not contain smallest signed value elements.
bool isNotMinSignedValue() const;
/// Return true if the value is the smallest signed value.
@@ -128,9 +133,10 @@ public:
Constant *getAggregateElement(unsigned Elt) const;
Constant *getAggregateElement(Constant *Elt) const;
- /// If this is a splat vector constant, meaning that all of the elements have
- /// the same value, return that value. Otherwise return 0.
- Constant *getSplatValue() const;
+ /// If all elements of the vector constant have the same value, return that
+ /// value. Otherwise, return nullptr. Ignore undefined elements by setting
+ /// AllowUndefs to true.
+ Constant *getSplatValue(bool AllowUndefs = false) const;
/// If C is a constant integer then return its value, otherwise C must be a
/// vector of constant integers, all equal, and the common value is returned.
@@ -188,6 +194,10 @@ public:
return const_cast<Constant*>(
static_cast<const Constant *>(this)->stripPointerCasts());
}
+
+ /// Try to replace undefined constant C or undefined elements in C with
+ /// Replacement. If no changes are made, the constant C is returned.
+ static Constant *replaceUndefsWith(Constant *C, Constant *Replacement);
};
} // end namespace llvm