Cranelift: remove non-egraphs optimization pipeline and use_egraphs option. (#6167)

* Cranelift: remove non-egraphs optimization pipeline and `use_egraphs` option.

This PR removes the LICM, GVN, and preopt passes, and associated support
pieces, from `cranelift-codegen`. Not to worry, we still have
optimizations: the egraph framework subsumes all of these, and has been
on by default since #5181.

A few decision points:

- Filetests for the legacy LICM, GVN and simple_preopt were removed too.
  As we built optimizations in the egraph framework we wrote new tests
  for the equivalent functionality, and many of the old tests were
  testing specific behaviors in the old implementations that may not be
  relevant anymore. However if folks prefer I could take a different
  approach here and try to port over all of the tests.

- The corresponding filetest modes (commands) were deleted too. The
  `test alias_analysis` mode remains, but no longer invokes a separate
  GVN first (since there is no separate GVN that will not also do alias
  analysis) so the tests were tweaked slightly to work with that. The
  egrpah testsuite also covers alias analysis.

- The `divconst_magic_numbers` module is removed since it's unused
  without `simple_preopt`, though this is the one remaining optimization
  we still need to build in the egraphs framework, pending #5908. The
  magic numbers will live forever in git history so removing this in the
  meantime is not a major issue IMHO.

- The `use_egraphs` setting itself was removed at both the Cranelift and
  Wasmtime levels. It has been marked deprecated for a few releases now
  (Wasmtime 6.0, 7.0, upcoming 8.0, and corresponding Cranelift
  versions) so I think this is probably OK. As an alternative if anyone
  feels strongly, we could leave the setting and make it a no-op.

* Update test outputs for remaining test differences.
This commit is contained in:
Chris Fallin
2023-04-06 11:11:03 -07:00
committed by GitHub
parent 465913eb2c
commit 230e2135d6
325 changed files with 3522 additions and 8783 deletions

View File

@@ -884,30 +884,6 @@ impl Config {
self
}
/// Configures the Cranelift code generator to use its
/// "egraph"-based mid-end optimizer.
///
/// This optimizer has replaced the compiler's more traditional
/// pipeline of optimization passes with a unified code-rewriting
/// system. It is on by default, but the traditional optimization
/// pass structure is still available for now (it is deprecrated and
/// will be removed in a future version).
///
/// The default value for this is `true`.
#[cfg(compiler)]
#[cfg_attr(nightlydoc, doc(cfg(any(feature = "cranelift", feature = "winch"))))] // see build.rs
#[deprecated(
since = "5.0.0",
note = "egraphs will be the default and this method will be removed in a future version."
)]
pub fn cranelift_use_egraphs(&mut self, enable: bool) -> &mut Self {
let val = if enable { "true" } else { "false" };
self.compiler_config
.settings
.insert("use_egraphs".to_string(), val.to_string());
self
}
/// Configures whether Cranelift should perform a NaN-canonicalization pass.
///
/// When Cranelift is used as a code generation backend this will configure

View File

@@ -412,7 +412,6 @@ impl Engine {
| "machine_code_cfg_info"
| "tls_model" // wasmtime doesn't use tls right now
| "opt_level" // opt level doesn't change semantics
| "use_egraphs" // optimizing with egraphs doesn't change semantics
| "enable_alias_analysis" // alias analysis-based opts don't change semantics
| "probestack_func_adjusts_sp" // probestack above asserted disabled
| "probestack_size_log2" // probestack above asserted disabled