diff options
Diffstat (limited to 'llvm/lib/VMCore')
| -rw-r--r-- | llvm/lib/VMCore/Constants.cpp | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/llvm/lib/VMCore/Constants.cpp b/llvm/lib/VMCore/Constants.cpp index 55e1539b5c1..e171011159c 100644 --- a/llvm/lib/VMCore/Constants.cpp +++ b/llvm/lib/VMCore/Constants.cpp @@ -122,6 +122,11 @@ Constant *Constant::getNullValue(const Type *Ty) { } } +Constant *Constant::getAllOnesValue(const Type *Ty) { + if (const IntegerType* ITy = dyn_cast<IntegerType>(Ty)) + return ConstantInt::get(APInt::getAllOnesValue(ITy->getBitWidth())); + return ConstantVector::getAllOnesValue(cast<VectorType>(Ty)); +} // Static constructor to create an integral constant with all bits set ConstantInt *ConstantInt::getAllOnesValue(const Type *Ty) { |

