Get the number of bits to set in a mask correct for a shl/lshr transform.

llvm-svn: 35357
This commit is contained in:
Reid Spencer 2007-03-26 17:18:58 +00:00
parent c0e64ed143
commit 3fea170ecd

View File

@ -5858,7 +5858,7 @@ Instruction *InstCombiner::FoldShiftByConstant(Value *Op0, ConstantInt *Op1,
BinaryOperator::createLShr(X, ConstantInt::get(Ty, ShiftDiff));
InsertNewInstBefore(Shift, I);
APInt Mask(APInt::getLowBitsSet(TypeBits, ShiftAmt2));
APInt Mask(APInt::getLowBitsSet(TypeBits, TypeBits - ShiftAmt2));
return BinaryOperator::createAnd(Shift, ConstantInt::get(Mask));
}