Changes in directory llvm/lib/VMCore:
Constants.cpp updated: 1.172 -> 1.173 --- Log message: add a new ConstantIntegral::get method. Simplify the implementation of ConstantInt::get --- Diffs of the changes: (+6 -3) Constants.cpp | 9 ++++++--- 1 files changed, 6 insertions(+), 3 deletions(-) Index: llvm/lib/VMCore/Constants.cpp diff -u llvm/lib/VMCore/Constants.cpp:1.172 llvm/lib/VMCore/Constants.cpp:1.173 --- llvm/lib/VMCore/Constants.cpp:1.172 Sun Nov 26 19:05:10 2006 +++ llvm/lib/VMCore/Constants.cpp Fri Dec 1 13:20:02 2006 @@ -929,9 +929,12 @@ // just return the stored value while getSExtValue has to convert back to sign // extended. getZExtValue is more common in LLVM than getSExtValue(). ConstantInt *ConstantInt::get(const Type *Ty, int64_t V) { - unsigned Size = Ty->getPrimitiveSizeInBits(); - uint64_t ZeroExtendedCanonicalization = V & (~uint64_t(0UL) >> (64-Size)); - return IntConstants->getOrCreate(Ty, ZeroExtendedCanonicalization ); + return IntConstants->getOrCreate(Ty, V & Ty->getIntegralTypeMask()); +} + +ConstantIntegral *ConstantIntegral::get(const Type *Ty, int64_t V) { + if (Ty == Type::BoolTy) return ConstantBool::get(V&1); + return IntConstants->getOrCreate(Ty, V & Ty->getIntegralTypeMask()); } //---- ConstantFP::get() implementation... _______________________________________________ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits