[llvm-commits] CVS: llvm/lib/VMCore/Constants.cpp

Chris Lattner sabre at nondot.org
Thu Jun 14 23:11:17 PDT 2007



Changes in directory llvm/lib/VMCore:

Constants.cpp updated: 1.229 -> 1.230
---
Log message:

add a Constant::getAllOnesValue helper function, which works on integers
AND vectors.


---
Diffs of the changes:  (+5 -0)

 Constants.cpp |    5 +++++
 1 files changed, 5 insertions(+)


Index: llvm/lib/VMCore/Constants.cpp
diff -u llvm/lib/VMCore/Constants.cpp:1.229 llvm/lib/VMCore/Constants.cpp:1.230
--- llvm/lib/VMCore/Constants.cpp:1.229	Thu May 24 09:36:04 2007
+++ llvm/lib/VMCore/Constants.cpp	Fri Jun 15 01:10:53 2007
@@ -122,6 +122,11 @@
   }
 }
 
+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) {






More information about the llvm-commits mailing list