Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
13 changes: 0 additions & 13 deletions cranelift/codegen/meta/src/shared/settings.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,19 +53,6 @@ pub(crate) fn define() -> SettingGroup {
true,
);

settings.add_bool(
"use_egraphs",
"Enable egraph-based optimization.",
r#"
This enables an optimization phase that converts CLIF to an egraph (equivalence graph)
representation, performs various rewrites, and then converts it back. This should result in
better optimization, but the traditional optimization pass structure is also still
available by setting this to `false`. The `false` setting will eventually be
deprecated and removed.
"#,
true,
);

settings.add_bool(
"enable_verifier",
"Run the Cranelift IR verifier at strategic times during compilation.",
Expand Down
46 changes: 1 addition & 45 deletions cranelift/codegen/src/context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,12 @@ use crate::flowgraph::ControlFlowGraph;
use crate::ir::Function;
use crate::isa::TargetIsa;
use crate::legalizer::simple_legalize;
use crate::licm::do_licm;
use crate::loop_analysis::LoopAnalysis;
use crate::machinst::{CompiledCode, CompiledCodeStencil};
use crate::nan_canonicalization::do_nan_canonicalization;
use crate::remove_constant_phis::do_remove_constant_phis;
use crate::result::{CodegenResult, CompileResult};
use crate::settings::{FlagsOrIsa, OptLevel};
use crate::simple_gvn::do_simple_gvn;
use crate::simple_preopt::do_preopt;
use crate::trace;
use crate::unreachable_code::eliminate_unreachable_code;
use crate::verifier::{verify_context, VerifierErrors, VerifierResult};
Expand Down Expand Up @@ -172,22 +169,12 @@ impl Context {
);

self.compute_cfg();
if !isa.flags().use_egraphs() && opt_level != OptLevel::None {
self.preopt(isa)?;
}
if isa.flags().enable_nan_canonicalization() {
self.canonicalize_nans(isa)?;
}

self.legalize(isa)?;

if !isa.flags().use_egraphs() && opt_level != OptLevel::None {
self.compute_domtree();
self.compute_loop_analysis();
self.licm(isa)?;
self.simple_gvn(isa)?;
}

self.compute_domtree();
self.eliminate_unreachable_code(isa)?;

Expand All @@ -198,14 +185,7 @@ impl Context {
self.remove_constant_phis(isa)?;

if opt_level != OptLevel::None {
if isa.flags().use_egraphs() {
self.egraph_pass()?;
} else if isa.flags().enable_alias_analysis() {
for _ in 0..2 {
self.replace_redundant_loads()?;
self.simple_gvn(isa)?;
}
}
self.egraph_pass()?;
}

Ok(())
Expand Down Expand Up @@ -294,13 +274,6 @@ impl Context {
Ok(())
}

/// Perform pre-legalization rewrites on the function.
pub fn preopt(&mut self, isa: &dyn TargetIsa) -> CodegenResult<()> {
do_preopt(&mut self.func, isa);
self.verify_if(isa)?;
Ok(())
}

/// Perform NaN canonicalizing rewrites on the function.
pub fn canonicalize_nans(&mut self, isa: &dyn TargetIsa) -> CodegenResult<()> {
do_nan_canonicalization(&mut self.func);
Expand Down Expand Up @@ -341,23 +314,6 @@ impl Context {
self.compute_domtree()
}

/// Perform simple GVN on the function.
pub fn simple_gvn<'a, FOI: Into<FlagsOrIsa<'a>>>(&mut self, fisa: FOI) -> CodegenResult<()> {
do_simple_gvn(&mut self.func, &mut self.domtree);
self.verify_if(fisa)
}

/// Perform LICM on the function.
pub fn licm(&mut self, isa: &dyn TargetIsa) -> CodegenResult<()> {
do_licm(
&mut self.func,
&mut self.cfg,
&mut self.domtree,
&mut self.loop_analysis,
);
self.verify_if(isa)
}

/// Perform unreachable code elimination.
pub fn eliminate_unreachable_code<'a, FOI>(&mut self, fisa: FOI) -> CodegenResult<()>
where
Expand Down
Loading