Do not compute 1ULL << 64, which is undefined. This fixes Ptrdist/ks on the

sparc, and testcase Regression/Transforms/InstCombine/2005-03-04-ShiftOverflow.ll


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@20445 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Chris Lattner 2005-03-04 23:21:33 +00:00
parent cff1fe5f9f
commit 8b9081081b

View File

@ -2563,7 +2563,8 @@ Instruction *InstCombiner::visitSetCondInst(BinaryOperator &I) {
Constant *Mask;
if (CI->getType()->isUnsigned()) {
unsigned TypeBits = CI->getType()->getPrimitiveSize()*8;
Val &= (1ULL << TypeBits)-1;
if (TypeBits != 64)
Val &= (1ULL << TypeBits)-1;
Mask = ConstantUInt::get(CI->getType(), Val);
} else {
Mask = ConstantSInt::get(CI->getType(), Val);