Skip to content

Commit 4875e06

Browse files
mtvecaaupov
authored andcommitted
[BOLT][NFC] Improve performance of MCPlusBuilder::initAliases
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. Reviewed By: Amir Differential Revision: https://reviews.llvm.org/D145779
1 parent fb3b392 commit 4875e06

File tree

1 file changed

+0
-8
lines changed

1 file changed

+0
-8
lines changed

bolt/lib/Core/MCPlusBuilder.cpp

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -464,17 +464,9 @@ void MCPlusBuilder::initAliases() {
464464
}
465465

466466
// Propagate smaller alias info upwards. Skip reg 0 (mapped to NoRegister)
467-
std::queue<MCPhysReg> Worklist;
468467
for (MCPhysReg I = 1, E = RegInfo->getNumRegs(); I < E; ++I)
469-
Worklist.push(I);
470-
while (!Worklist.empty()) {
471-
MCPhysReg I = Worklist.front();
472-
Worklist.pop();
473468
for (MCSubRegIterator SI(I, RegInfo); SI.isValid(); ++SI)
474469
SmallerAliasMap[I] |= SmallerAliasMap[*SI];
475-
for (MCSuperRegIterator SI(I, RegInfo); SI.isValid(); ++SI)
476-
Worklist.push(*SI);
477-
}
478470

479471
LLVM_DEBUG({
480472
dbgs() << "Dumping reg alias table:\n";

0 commit comments

Comments
 (0)