[PATCH] D155020: [ConstantHoisting] simplify NumUses accounting NFC
Nick Desaulniers via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Jul 11 14:59:44 PDT 2023
nickdesaulniers created this revision.
Herald added a subscriber: hiraditya.
Herald added a reviewer: ributzka.
Herald added a project: All.
nickdesaulniers requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.
The `Uses` variable is unnecessary. Just use `UsesNum` instead.
Repository:
rG LLVM Github Monorepo
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.539305.patch
Type: text/x-patch
Size: 1175 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230711/bc978ccf/attachment.bin>
More information about the llvm-commits
mailing list