Some targets may add required passes via
TargetMachine::registerPipelineStartEPassBuilderCallbacks(). We need to run those even
under -O0. As an example, BPFTargetMachine adds
BPFAbstractMemberAccessPass, a required pass.
The legacy PM adds EP_EarlyAsPossible and EP_EnabledOnOptLevel0 for -O0. This also allows us to clean up BackendUtil.cpp (and out-of-tree Rust
We match EP_EarlyAsPossible here. Currently EP_EnabledOnOptLevel0 is usage of the NPM) by allowing us to share added passes like coroutines
only used for coroutine and sanitizer passes, which can be manually
added (as is currently done). (This can be revised in the future if
deemed necessary) and sanitizers between -O0 and other optimization levels.
Tests are a continuation of those added in
In order to prevent TargetMachines from adding unnecessary optimization
passes at -O0, TargetMachine::registerPassBuilderCallbacks() will be
changed to take an OptimizationLevel, but that will be done separately.