[llvm] 6bc0e36 - [DAG] TargetLowering::ShrinkDemandedOp - move SmallVTBits iterator inside for loop. NFC

Simon Pilgrim via llvm-commits llvm-commits at lists.llvm.org
Thu Mar 16 05:12:46 PDT 2023


Author: Simon Pilgrim
Date: 2023-03-16T12:12:33Z
New Revision: 6bc0e362d74c955e4c5558f380d968f2a494f677

URL: https://github.com/llvm/llvm-project/commit/6bc0e362d74c955e4c5558f380d968f2a494f677
DIFF: https://github.com/llvm/llvm-project/commit/6bc0e362d74c955e4c5558f380d968f2a494f677.diff

LOG: [DAG] TargetLowering::ShrinkDemandedOp - move SmallVTBits iterator inside for loop. NFC

Added: 
    

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

Removed: 
    


################################################################################
diff  --git a/llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp b/llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp
index 6d7977b766a7..362330cd0ae2 100644
--- a/llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp
+++ b/llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp
@@ -576,9 +576,8 @@ bool TargetLowering::ShrinkDemandedOp(SDValue Op, unsigned BitWidth,
   // Op's type. For expedience, just check power-of-2 integer types.
   const TargetLowering &TLI = DAG.getTargetLoweringInfo();
   unsigned DemandedSize = DemandedBits.getActiveBits();
-  unsigned SmallVTBits = DemandedSize;
-  SmallVTBits = llvm::bit_ceil(SmallVTBits);
-  for (; SmallVTBits < BitWidth; SmallVTBits = NextPowerOf2(SmallVTBits)) {
+  for (unsigned SmallVTBits = llvm::bit_ceil(DemandedSize);
+       SmallVTBits < BitWidth; SmallVTBits = NextPowerOf2(SmallVTBits)) {
     EVT SmallVT = EVT::getIntegerVT(*DAG.getContext(), SmallVTBits);
     if (TLI.isTruncateFree(VT, SmallVT) && TLI.isZExtFree(SmallVT, VT)) {
       // We found a type with free casts.


        


More information about the llvm-commits mailing list