[llvm] r313839 - [SelectionDAG] Use APInt::getActivebits instead of Bitwidth - leading zeros.

Craig Topper via llvm-commits llvm-commits at lists.llvm.org
Wed Sep 20 16:48:56 PDT 2017


Author: ctopper
Date: Wed Sep 20 16:48:56 2017
New Revision: 313839

URL: http://llvm.org/viewvc/llvm-project?rev=313839&view=rev
Log:
[SelectionDAG] Use APInt::getActivebits instead of Bitwidth - leading zeros.

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=313839&r1=313838&r2=313839&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/SelectionDAG/TargetLowering.cpp (original)
+++ llvm/trunk/lib/CodeGen/SelectionDAG/TargetLowering.cpp Wed Sep 20 16:48:56 2017
@@ -408,7 +408,7 @@ bool TargetLowering::ShrinkDemandedOp(SD
   // Search for the smallest integer type with free casts to and from
   // Op's type. For expedience, just check power-of-2 integer types.
   const TargetLowering &TLI = DAG.getTargetLoweringInfo();
-  unsigned DemandedSize = BitWidth - Demanded.countLeadingZeros();
+  unsigned DemandedSize = Demanded.getActiveBits();
   unsigned SmallVTBits = DemandedSize;
   if (!isPowerOf2_32(SmallVTBits))
     SmallVTBits = NextPowerOf2(SmallVTBits);




More information about the llvm-commits mailing list