forked from OSchip/llvm-project
[InstCombine] FoldShiftByConstant - create Scalar/Vector constant with ConstantInt::get(). NFCI.
There's no need to create constant vector splats manually - missed this one in rG24dd0cd1edd5
This commit is contained in:
parent
1b962fdd5f
commit
4ff7136268
|
@ -776,11 +776,8 @@ Instruction *InstCombinerImpl::FoldShiftByConstant(Value *Op0, Constant *Op1,
|
|||
Value *X = Builder.CreateBinOp(Op0BO->getOpcode(), V1, YS,
|
||||
Op0BO->getOperand(0)->getName());
|
||||
unsigned Op1Val = Op1C->getLimitedValue(TypeBits);
|
||||
|
||||
APInt Bits = APInt::getHighBitsSet(TypeBits, TypeBits - Op1Val);
|
||||
Constant *Mask = ConstantInt::get(I.getContext(), Bits);
|
||||
if (VectorType *VT = dyn_cast<VectorType>(X->getType()))
|
||||
Mask = ConstantVector::getSplat(VT->getElementCount(), Mask);
|
||||
Constant *Mask = ConstantInt::get(Ty, Bits);
|
||||
return BinaryOperator::CreateAnd(X, Mask);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue