This patch disables the SIFormMemoryClauses pass at -O1. This pass has a significant impact on compilation time, so we only want it to be enabled starting from -O2.
I'm planning to disable it at -O1 for now, then investigate to improve the implementation for the default optimization level so we can eventually re-enable the pass at O1 too. Does that work for you?
On small functions I think the run time of this pass is dominated by the two calls to TRI->getAllocatableSet, which means two identical calls to SIRegisterInfo::getReservedRegs, which has a very large fixed cost. Is there some way the Reserved register set can be cached (in the SIMachineFunctionInfo object?)?
@foad you're right. But caching the result of getReservedRegs is not easy because it difficult to detect that the calls are from consecutive calls to getAllocatableSet. I instead added the TargetRegisterInfo::getAllocatableSets method allowing to get allocatable sets for multiple register classes so we can call getReservedRegs a single time for all the classes.
I started looking at this, but I'm not sure it makes sense to do without also changing quite a bit of other infrastructure to work on regunits at the same time
|270 ↗||(On Diff #343689)|
Why is this recomputing the reserved regs instead of just querying MRI::getReservedRegs?
|276 ↗||(On Diff #343689)|
This is a separate patch
|280–289 ↗||(On Diff #343689)|
Most of this function is a duplictae of getAllocatableSet