]> granicus.if.org Git - llvm/commitdiff
Use APInt::getOneBitSet instead of APInt::getBitsSet for sign bit mask creation
authorSimon Pilgrim <llvm-dev@redking.me.uk>
Fri, 3 Mar 2017 16:35:57 +0000 (16:35 +0000)
committerSimon Pilgrim <llvm-dev@redking.me.uk>
Fri, 3 Mar 2017 16:35:57 +0000 (16:35 +0000)
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

lib/CodeGen/SelectionDAG/TargetLowering.cpp

index 3785f402c3e8f5ef001e17374bd15d1e1354fde3..b1bfd47eb02debb37209e8d119fe89c6421f4776 100644 (file)
@@ -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.