Change the phase ordering of SROA in the LTO to enable more cse opportunities.
|50 ms||x64 debian > LLVM.Other::opt-LTO-pipeline.ll|
Script: -- : 'RUN: at line 1'; /var/lib/buildkite-agent/builds/llvm-project/build/bin/opt -enable-new-pm=0 -mtriple=x86_64-- -std-link-opts -debug-pass=Structure < /var/lib/buildkite-agent/builds/llvm-project/llvm/test/Other/opt-LTO-pipeline.ll -o /dev/null 2>&1 | /var/lib/buildkite-agent/builds/llvm-project/build/bin/FileCheck --check-prefix=CHECK /var/lib/buildkite-agent/builds/llvm-project/llvm/test/Other/opt-LTO-pipeline.ll
|80 ms||x64 windows > LLVM.Other::opt-LTO-pipeline.ll|
Script: -- : 'RUN: at line 1'; c:\ws\w4\llvm-project\premerge-checks\build\bin\opt.exe -enable-new-pm=0 -mtriple=x86_64-- -std-link-opts -debug-pass=Structure < C:\ws\w4\llvm-project\premerge-checks\llvm\test\Other\opt-LTO-pipeline.ll -o /dev/null 2>&1 | c:\ws\w4\llvm-project\premerge-checks\build\bin\filecheck.exe --check-prefix=CHECK C:\ws\w4\llvm-project\premerge-checks\llvm\test\Other\opt-LTO-pipeline.ll
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.
I may be reading this wrong, but to me it looks like we no longer do any SROA after running the inliner.