-
Notifications
You must be signed in to change notification settings - Fork 14.3k
[NFC][CodeLayout] Remove unused parameter #110145
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
@llvm/pr-subscribers-llvm-transforms Author: Ellis Hoag (ellishg) ChangesThe Full diff: https://github.com/llvm/llvm-project/pull/110145.diff 3 Files Affected:
diff --git a/llvm/include/llvm/Transforms/Utils/CodeLayout.h b/llvm/include/llvm/Transforms/Utils/CodeLayout.h
index 3ba8b9137113b7..c737643ee1014a 100644
--- a/llvm/include/llvm/Transforms/Utils/CodeLayout.h
+++ b/llvm/include/llvm/Transforms/Utils/CodeLayout.h
@@ -49,12 +49,10 @@ std::vector<uint64_t> computeExtTspLayout(ArrayRef<uint64_t> NodeSizes,
/// the given order, which is anti-correlated with the number of I-cache misses
/// in a typical execution of the function.
double calcExtTspScore(ArrayRef<uint64_t> Order, ArrayRef<uint64_t> NodeSizes,
- ArrayRef<uint64_t> NodeCounts,
ArrayRef<EdgeCount> EdgeCounts);
/// Estimate the "quality" of the current node order in CFG.
double calcExtTspScore(ArrayRef<uint64_t> NodeSizes,
- ArrayRef<uint64_t> NodeCounts,
ArrayRef<EdgeCount> EdgeCounts);
/// Algorithm-specific params for Cache-Directed Sort. The values are tuned for
diff --git a/llvm/lib/CodeGen/MachineBlockPlacement.cpp b/llvm/lib/CodeGen/MachineBlockPlacement.cpp
index a52c82d77ca644..7807875c06584c 100644
--- a/llvm/lib/CodeGen/MachineBlockPlacement.cpp
+++ b/llvm/lib/CodeGen/MachineBlockPlacement.cpp
@@ -3619,9 +3619,8 @@ void MachineBlockPlacement::applyExtTsp() {
<< " with profile = " << F->getFunction().hasProfileData()
<< " (" << F->getName().str() << ")"
<< "\n");
- LLVM_DEBUG(
- dbgs() << format(" original layout score: %0.2f\n",
- calcExtTspScore(BlockSizes, BlockCounts, JumpCounts)));
+ LLVM_DEBUG(dbgs() << format(" original layout score: %0.2f\n",
+ calcExtTspScore(BlockSizes, JumpCounts)));
// Run the layout algorithm.
auto NewOrder = computeExtTspLayout(BlockSizes, BlockCounts, JumpCounts);
@@ -3630,9 +3629,9 @@ void MachineBlockPlacement::applyExtTsp() {
for (uint64_t Node : NewOrder) {
NewBlockOrder.push_back(CurrentBlockOrder[Node]);
}
- LLVM_DEBUG(dbgs() << format(" optimized layout score: %0.2f\n",
- calcExtTspScore(NewOrder, BlockSizes, BlockCounts,
- JumpCounts)));
+ LLVM_DEBUG(
+ dbgs() << format(" optimized layout score: %0.2f\n",
+ calcExtTspScore(NewOrder, BlockSizes, JumpCounts)));
// Assign new block order.
assignBlockOrder(NewBlockOrder);
diff --git a/llvm/lib/Transforms/Utils/CodeLayout.cpp b/llvm/lib/Transforms/Utils/CodeLayout.cpp
index 95edd27c675d24..baaad8bb48f33d 100644
--- a/llvm/lib/Transforms/Utils/CodeLayout.cpp
+++ b/llvm/lib/Transforms/Utils/CodeLayout.cpp
@@ -1427,20 +1427,18 @@ codelayout::computeExtTspLayout(ArrayRef<uint64_t> NodeSizes,
double codelayout::calcExtTspScore(ArrayRef<uint64_t> Order,
ArrayRef<uint64_t> NodeSizes,
- ArrayRef<uint64_t> NodeCounts,
ArrayRef<EdgeCount> EdgeCounts) {
// Estimate addresses of the blocks in memory.
- std::vector<uint64_t> Addr(NodeSizes.size(), 0);
- for (size_t Idx = 1; Idx < Order.size(); Idx++) {
+ SmallVector<uint64_t> Addr(NodeSizes.size(), 0);
+ for (uint64_t Idx = 1; Idx < Order.size(); Idx++)
Addr[Order[Idx]] = Addr[Order[Idx - 1]] + NodeSizes[Order[Idx - 1]];
- }
- std::vector<uint64_t> OutDegree(NodeSizes.size(), 0);
- for (auto Edge : EdgeCounts)
+ SmallVector<uint64_t> OutDegree(NodeSizes.size(), 0);
+ for (auto &Edge : EdgeCounts)
++OutDegree[Edge.src];
// Increase the score for each jump.
double Score = 0;
- for (auto Edge : EdgeCounts) {
+ for (auto &Edge : EdgeCounts) {
bool IsConditional = OutDegree[Edge.src] > 1;
Score += ::extTSPScore(Addr[Edge.src], NodeSizes[Edge.src], Addr[Edge.dst],
Edge.count, IsConditional);
@@ -1449,13 +1447,11 @@ double codelayout::calcExtTspScore(ArrayRef<uint64_t> Order,
}
double codelayout::calcExtTspScore(ArrayRef<uint64_t> NodeSizes,
- ArrayRef<uint64_t> NodeCounts,
ArrayRef<EdgeCount> EdgeCounts) {
- std::vector<uint64_t> Order(NodeSizes.size());
- for (size_t Idx = 0; Idx < NodeSizes.size(); Idx++) {
+ SmallVector<uint64_t> Order(NodeSizes.size());
+ for (uint64_t Idx = 0; Idx < NodeSizes.size(); Idx++)
Order[Idx] = Idx;
- }
- return calcExtTspScore(Order, NodeSizes, NodeCounts, EdgeCounts);
+ return calcExtTspScore(Order, NodeSizes, EdgeCounts);
}
std::vector<uint64_t> codelayout::computeCacheDirectedLayout(
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
LLVM Buildbot has detected a new failure on builder Full details are available at: https://lab.llvm.org/buildbot/#/builders/73/builds/6207 Here is the relevant piece of the build log for the reference
|
The `NodeCounts` parameter of `calcExtTspScore()` is unused, so remove it. Use `SmallVector` since arrays are expected to be small since they represent MBBs.
The
NodeCounts
parameter ofcalcExtTspScore()
is unused, so remove it.Use
SmallVector
since arrays are expected to be small since they represent MBBs.