Change the phase ordering of SROA in the LTO to enable more cse opportunities.
Details
- Reviewers
- None
Diff Detail
- Repository
- rG LLVM Github Monorepo
Unit Tests
Event Timeline
This is only changing LTO side of obsolete pass manager.
If that is intentional, i'm not sure it's really worthwhile - it's obsolete pass manager is obsolete.
When I added -flto, this pass will be invoked. The LTO is used in the release build at Uber. Why do you think it is obsolete?
Got you. The new pass manager is enabled by default starting from LLVM 12. I am using xcode 12.4 which uses prior version of llvm.
The default of a specific Xcode version is not really relevant to upstream LLVM. If you build & use your own version of libLTO with Xcode's` ld, it would use the default of the upstream project anyways, right?
If this change has clear benefits, it should be used by both the new pass manager and the legacy one. Otherwise there may be additional regressions when the new pass manager is used.
To move forward with the patch, it would be good to include a phase-ordering test that shows the improvement of the new order. It would also be helpful if you could provide data on the impact in term of code-size and runtime performance on a larger set of programs/benchmarks to motivate the change.
I have three comments:
- I don't think we should do any old-pm specific changes. If this applies to the new-pm, then sure, old-pm can be changed to keep it in sync.
- I'm not sure why this is LTO-specific. Why should this not apply to the regular pipeline?
- I'm extremely unconvinced that simply moving SROA run like it is done in the patch now is okay.
llvm/lib/Transforms/IPO/PassManagerBuilder.cpp | ||
---|---|---|
1084–1100 | I may be reading this wrong, but to me it looks like we no longer do any SROA after running the inliner. |
I may be reading this wrong, but to me it looks like we no longer do any SROA after running the inliner.
This function is called by populateLTOPassManager(), it does then call addLateLTOOptimizationPasses(),
but that one doesn't schedule any additional SROA runs.