[PATCH] D145779: [BOLT][NFC] Improve performance of MCPlusBuilder::initAliases
Job Noorman via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Mar 10 02:57:04 PST 2023
jobnoorman created this revision.
jobnoorman added reviewers: yota9, maksfb, rafauler.
Herald added subscribers: treapster, pmatos, ayermolo, jeroen.dobbelaere, kristof.beyls.
Herald added a reviewer: Amir.
Herald added a project: All.
jobnoorman requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.
It was using a redundant iteration over super regs to build
SmallerAliasMap. Removing this results in exactly the same alias maps
and a noticeable performance gain on targets with a large number of
registers.
Just anecdotally: on my machine, processing a small AArch64 binary went
from 2.7s down to 80ms.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D145779
Files:
bolt/lib/Core/MCPlusBuilder.cpp
Index: bolt/lib/Core/MCPlusBuilder.cpp
===================================================================
--- bolt/lib/Core/MCPlusBuilder.cpp
+++ bolt/lib/Core/MCPlusBuilder.cpp
@@ -464,17 +464,9 @@
}
// Propagate smaller alias info upwards. Skip reg 0 (mapped to NoRegister)
- std::queue<MCPhysReg> Worklist;
for (MCPhysReg I = 1, E = RegInfo->getNumRegs(); I < E; ++I)
- Worklist.push(I);
- while (!Worklist.empty()) {
- MCPhysReg I = Worklist.front();
- Worklist.pop();
for (MCSubRegIterator SI(I, RegInfo); SI.isValid(); ++SI)
SmallerAliasMap[I] |= SmallerAliasMap[*SI];
- for (MCSuperRegIterator SI(I, RegInfo); SI.isValid(); ++SI)
- Worklist.push(*SI);
- }
LLVM_DEBUG({
dbgs() << "Dumping reg alias table:\n";
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D145779.504075.patch
Type: text/x-patch
Size: 770 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230310/3322cfa6/attachment.bin>
More information about the llvm-commits
mailing list