[PATCH] D145779: [BOLT][NFC] Improve performance of MCPlusBuilder::initAliases

Job Noorman via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Mar 14 02:28:31 PDT 2023


jobnoorman added inline comments.


================
Comment at: bolt/lib/Core/MCPlusBuilder.cpp:468
   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];
----------------
rafauler wrote:
> X86 has registers with subregs, which in turn has their own subregs. e.g. RAX -> EAX -> AX -> AH, AL
> 
> I'm curious whether the subreg iterator here is returning the transitive list of all sub regs of a register? e.g. would it return AL as a subreg of RAX?  That's what the old code was computing.
It does:

```
// prints EAX AX AL AH HAX
for (MCSubRegIterator SI(X86::RAX, RegInfo); SI.isValid(); ++SI) {
  dbgs() << RegInfo->getName(*SI) << " ";
}
```


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D145779/new/

https://reviews.llvm.org/D145779



More information about the llvm-commits mailing list