This patch disables some of the passes at -O1. These passes have a significant impact on compilation time, so we only want them to be enabled starting from -O2.
Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
Needs a testcase. I think we have some pass pipeline tests already to show what's run (maybe not for -O1, I didn't know anyone actually used it)
@arsenm, I think we only had a test case for opt, so I added a new test case to show which passes are run for llc for all the optimization levels.
llvm/test/CodeGen/AMDGPU/llc-pipeline.ll | ||
---|---|---|
9 | I would suggest not checking the "Pass Arguments:" line at all here, since any diffs to this very long line will be very hard to read anyway. All the information should be contained in the lines below. |
llvm/lib/Target/AMDGPU/AMDGPUTargetMachine.cpp | ||
---|---|---|
903–905 | This seems like a weird interaction between flags. Maybe this should check if EnableScalarIRPasses was explicitly used? Or maybe we can just drop EnableScalarIRPasses entirely |
llvm/lib/Target/AMDGPU/AMDGPUTargetMachine.cpp | ||
---|---|---|
903–905 | I agree that EnableScalarIRPasses.getNumOccurrences() ? EnableScalarIRPasses : TM.getOptLevel() > CodeGenOpt::Less would be saner. |
Enable the passes only from -O2 or when explicitly enabled with flags. Also update the test case to ensure the passes are run for -O1 when explicitly enabled.
llvm/lib/Target/AMDGPU/AMDGPUTargetMachine.cpp | ||
---|---|---|
903–905 | You're right, that makes a lot more sense. I just updated the patch and added a RUN line in the test case to ensure the passes are run for -O1 when we explicitly provide the flags. |
This breaks incremental builders: http://45.33.8.238/linux/45830/step_12.txt
Ptal. You'll need a -o /dev/null and an rm -f for the temp file to clean up bots (can remove the latter after a bit)
@thakis I already committed a fix to avoid generating the .s file. Should I add the rm -f directly into the RUN lines ? Is something like RUN: rm %S/llc-pipeline.s -f ok ?
Yes, that sounds perfect. See e.g. clang/test/CoverageMapping/coroutine.cpp for an example :)
llc-pipeline.ll has problems with -DLLVM_ENABLE_EXPENSIVE_CHECKS=1 as instruction verification seems to still take place.
This seems like a weird interaction between flags. Maybe this should check if EnableScalarIRPasses was explicitly used? Or maybe we can just drop EnableScalarIRPasses entirely