From e150e2df424b162710b36a1ec5ef90270ffb435b Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Thu, 26 Jan 2012 02:31:22 +0000 Subject: Add a ConstantDataVector::getSplatValue() method, for parity with ConstantVector. Fix some outright bugs in the implementation of ConstantArray and Constant struct, which would cause us to not make one big UndefValue when asking for an array/struct with all undef elements. Enhance Constant::isAllOnesValue to work with ConstantDataVector. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@149021 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/llvm/Constants.h | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'include/llvm/Constants.h') diff --git a/include/llvm/Constants.h b/include/llvm/Constants.h index a685ccc..1180b95 100644 --- a/include/llvm/Constants.h +++ b/include/llvm/Constants.h @@ -766,6 +766,10 @@ public: /// i32/i64/float/double) and must be a ConstantFP or ConstantInt. static Constant *getSplat(unsigned NumElts, Constant *Elt); + /// getSplatValue - If this is a splat constant, meaning that all of the + /// elements have the same value, return that value. Otherwise return NULL. + Constant *getSplatValue() const; + /// getType - Specialize the getType() method to always return a VectorType, /// which reduces the amount of casting needed in parts of the compiler. /// -- cgit v1.1