[llvm] cb79b5b - [ConstantHoisting] simplify NumUses accounting NFC
Nick Desaulniers via llvm-commits
llvm-commits at lists.llvm.org
Wed Jul 12 09:54:01 PDT 2023
Author: Nick Desaulniers
Date: 2023-07-12T09:53:46-07:00
New Revision: cb79b5b571f628c1f30f8d8e5d73bb6efc5c36d4
URL: https://github.com/llvm/llvm-project/commit/cb79b5b571f628c1f30f8d8e5d73bb6efc5c36d4
DIFF: https://github.com/llvm/llvm-project/commit/cb79b5b571f628c1f30f8d8e5d73bb6efc5c36d4.diff
LOG: [ConstantHoisting] simplify NumUses accounting NFC
The `Uses` variable is unnecessary. Just use `UsesNum` instead.
Reviewed By: MaskRay
Differential Revision: https://reviews.llvm.org/D155020
Added:
Modified:
llvm/lib/Transforms/Scalar/ConstantHoisting.cpp
Removed:
################################################################################
diff --git a/llvm/lib/Transforms/Scalar/ConstantHoisting.cpp b/llvm/lib/Transforms/Scalar/ConstantHoisting.cpp
index 18c9d039a5100b..a0d397f7c6880b 100644
--- a/llvm/lib/Transforms/Scalar/ConstantHoisting.cpp
+++ b/llvm/lib/Transforms/Scalar/ConstantHoisting.cpp
@@ -853,12 +853,12 @@ bool ConstantHoistingPass::emitBaseConstants(GlobalVariable *BaseGV) {
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 @@ bool ConstantHoistingPass::emitBaseConstants(GlobalVariable *BaseGV) {
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.
More information about the llvm-commits
mailing list