[PATCH] D155020: [ConstantHoisting] simplify NumUses accounting NFC

Nick Desaulniers via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jul 12 09:54:08 PDT 2023


This revision was automatically updated to reflect the committed changes.
Closed by commit rGcb79b5b571f6: [ConstantHoisting] simplify NumUses accounting NFC (authored by nickdesaulniers).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D155020/new/

https://reviews.llvm.org/D155020

Files:
  llvm/lib/Transforms/Scalar/ConstantHoisting.cpp


Index: llvm/lib/Transforms/Scalar/ConstantHoisting.cpp
===================================================================
--- llvm/lib/Transforms/Scalar/ConstantHoisting.cpp
+++ llvm/lib/Transforms/Scalar/ConstantHoisting.cpp
@@ -853,12 +853,12 @@
     unsigned NotRebasedNum = 0;
     for (Instruction *IP : IPSet) {
       // First, collect constants depending on this IP of the base.
-      unsigned Uses = 0;
+      UsesNum = 0;
       using RebasedUse = std::tuple<Constant *, Type *, ConstantUser>;
       SmallVector<RebasedUse, 4> ToBeRebased;
       for (auto const &RCI : ConstInfo.RebasedConstants) {
+        UsesNum += RCI.Uses.size();
         for (auto const &U : RCI.Uses) {
-          Uses++;
           BasicBlock *OrigMatInsertBB =
               findMatInsertPt(U.Inst, U.OpndIdx)->getParent();
           // If Base constant is to be inserted in multiple places,
@@ -868,7 +868,6 @@
             ToBeRebased.push_back(RebasedUse(RCI.Offset, RCI.Ty, U));
         }
       }
-      UsesNum = Uses;
 
       // If only few constants depend on this IP of base, skip rebasing,
       // assuming the base and the rebased have the same materialization cost.


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D155020.539615.patch
Type: text/x-patch
Size: 1175 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230712/3a157a70/attachment.bin>


More information about the llvm-commits mailing list