From: Simon Pilgrim Date: Fri, 3 Mar 2017 16:35:57 +0000 (+0000) Subject: Use APInt::getOneBitSet instead of APInt::getBitsSet for sign bit mask creation X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=b5264466287644712c68cf476d8b38b410b9220a;p=llvm Use APInt::getOneBitSet instead of APInt::getBitsSet for sign bit mask creation Avoids all the unnecessary extra bitrange creation/shift stages. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@296879 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/CodeGen/SelectionDAG/TargetLowering.cpp b/lib/CodeGen/SelectionDAG/TargetLowering.cpp index 3785f402c3e..b1bfd47eb02 100644 --- a/lib/CodeGen/SelectionDAG/TargetLowering.cpp +++ b/lib/CodeGen/SelectionDAG/TargetLowering.cpp @@ -1099,7 +1099,7 @@ bool TargetLowering::SimplifyDemandedBits(SDValue Op, EVT InVT = Op.getOperand(0).getValueType(); unsigned InBits = InVT.getScalarSizeInBits(); APInt InMask = APInt::getLowBitsSet(BitWidth, InBits); - APInt InSignBit = APInt::getBitsSet(BitWidth, InBits - 1, InBits); + APInt InSignBit = APInt::getOneBitSet(BitWidth, InBits - 1); APInt NewBits = ~InMask & NewMask; // If none of the top bits are demanded, convert this into an any_extend.