[llvm] r296879 - Use APInt::getOneBitSet instead of APInt::getBitsSet for sign bit mask creation

Simon Pilgrim via llvm-commits llvm-commits at lists.llvm.org
Fri Mar 3 08:35:57 PST 2017


Author: rksimon
Date: Fri Mar  3 10:35:57 2017
New Revision: 296879

URL: http://llvm.org/viewvc/llvm-project?rev=296879&view=rev
Log:
Use APInt::getOneBitSet instead of APInt::getBitsSet for sign bit mask creation

Avoids all the unnecessary extra bitrange creation/shift stages.

Modified:
    llvm/trunk/lib/CodeGen/SelectionDAG/TargetLowering.cpp

Modified: llvm/trunk/lib/CodeGen/SelectionDAG/TargetLowering.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/TargetLowering.cpp?rev=296879&r1=296878&r2=296879&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/SelectionDAG/TargetLowering.cpp (original)
+++ llvm/trunk/lib/CodeGen/SelectionDAG/TargetLowering.cpp Fri Mar  3 10:35:57 2017
@@ -1099,7 +1099,7 @@ bool TargetLowering::SimplifyDemandedBit
     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.




More information about the llvm-commits mailing list