Auto merge of #119672 - cjgillot:dse-sandwich, r=oli-obk
Sandwich MIR optimizations between DSE. This PR reorders MIR optimization passes in an attempt to increase their efficiency. - Stop running CopyProp before GVN, it's useless as GVN will do the same thing anyway. Instead, we perform CopyProp at the end of the pipeline, to ensure we do not emit copy/move chains. - Run DSE before GVN, as it increases the probability to have single-assignment locals. - Run DSE after the final CopyProp to turn copies into moves. r? `@ghost`
This commit is contained in:
@@ -596,24 +596,25 @@ fn run_optimization_passes<'tcx>(tcx: TyCtxt<'tcx>, body: &mut Body<'tcx>) {
|
||||
&multiple_return_terminators::MultipleReturnTerminators,
|
||||
&instsimplify::InstSimplify,
|
||||
&simplify::SimplifyLocals::BeforeConstProp,
|
||||
©_prop::CopyProp,
|
||||
&dead_store_elimination::DeadStoreElimination::Initial,
|
||||
&gvn::GVN,
|
||||
&simplify::SimplifyLocals::AfterGVN,
|
||||
// Perform `SeparateConstSwitch` after SSA-based analyses, as cloning blocks may
|
||||
// destroy the SSA property. It should still happen before const-propagation, so the
|
||||
// latter pass will leverage the created opportunities.
|
||||
&separate_const_switch::SeparateConstSwitch,
|
||||
&gvn::GVN,
|
||||
&simplify::SimplifyLocals::AfterGVN,
|
||||
&dataflow_const_prop::DataflowConstProp,
|
||||
&const_debuginfo::ConstDebugInfo,
|
||||
&o1(simplify_branches::SimplifyConstCondition::AfterConstProp),
|
||||
&jump_threading::JumpThreading,
|
||||
&early_otherwise_branch::EarlyOtherwiseBranch,
|
||||
&simplify_comparison_integral::SimplifyComparisonIntegral,
|
||||
&dead_store_elimination::DeadStoreElimination,
|
||||
&dest_prop::DestinationPropagation,
|
||||
&o1(simplify_branches::SimplifyConstCondition::Final),
|
||||
&o1(remove_noop_landing_pads::RemoveNoopLandingPads),
|
||||
&o1(simplify::SimplifyCfg::Final),
|
||||
©_prop::CopyProp,
|
||||
&dead_store_elimination::DeadStoreElimination::Final,
|
||||
&nrvo::RenameReturnPlace,
|
||||
&simplify::SimplifyLocals::Final,
|
||||
&multiple_return_terminators::MultipleReturnTerminators,
|
||||
|
||||
Reference in New Issue
Block a user