[all-commits] [llvm/llvm-project] 4d0f1e: [llvm] Remove SmallSet from MachineInstr.h
Elliot Goodrich via All-commits
all-commits at lists.llvm.org
Sat Aug 12 10:23:03 PDT 2023
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: 4d0f1e328245d802665cf564eb0449b867ce8a48
https://github.com/llvm/llvm-project/commit/4d0f1e328245d802665cf564eb0449b867ce8a48
Author: Elliot Goodrich <elliotgoodrich at gmail.com>
Date: 2023-08-12 (Sat, 12 Aug 2023)
Changed paths:
M llvm/include/llvm/CodeGen/GlobalISel/LoadStoreOpt.h
M llvm/include/llvm/CodeGen/MachineInstr.h
M llvm/lib/CodeGen/CalcSpillWeights.cpp
M llvm/lib/CodeGen/RegAllocFast.cpp
M llvm/lib/Target/RISCV/RISCVOptWInstrs.cpp
M llvm/lib/Target/RISCV/RISCVRVVInitUndef.cpp
M llvm/lib/Target/RISCV/RISCVRegisterInfo.cpp
M llvm/lib/Target/WebAssembly/WebAssemblyExceptionInfo.h
M llvm/lib/Target/WebAssembly/WebAssemblyLowerEmscriptenEHSjLj.cpp
M llvm/lib/Target/WebAssembly/WebAssemblyLowerRefTypesIntPtrConv.cpp
M llvm/lib/Target/X86/X86PreTileConfig.cpp
Log Message:
-----------
[llvm] Remove SmallSet from MachineInstr.h
`MachineInstr.h` is a commonly included file and this includes
`llvm/ADT/SmallSet.h` for one function `getUsedDebugRegs()`, which is
used only in one place.
According to `ClangBuildAnalyzer` (run solely on building LLVM, no other
projects) the second most expensive template to instantiate is the
`SmallSet::insert` method used in the `inline` implementation in
`getUsedDebugRegs()`:
```
**** Templates that took longest to instantiate:
554239 ms: std::unordered_map<int, int> (2826 times, avg 196 ms)
521187 ms: llvm::SmallSet<llvm::Register, 4>::insert (930 times, avg 560
ms)
...
```
By removing this method and putting its implementation in the one call
site we greatly reduce the template instantiation time and reduce the
number of includes.
When copying the implementation, I removed a check on `MO.getReg()` as
this is checked within `MO.isVirtual()`.
Differential Revision: https://reviews.llvm.org/D157720
More information about the All-commits
mailing list