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
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions cranelift/codegen/src/alias_analysis.rs
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@

use crate::{
cursor::{Cursor, FuncCursor},
dominator_tree::DominatorTreePreorder,
dominator_tree::DominatorTree,
inst_predicates::{
has_memory_fence_semantics, inst_addr_offset_type, inst_store_data, visit_block_succs,
},
Expand Down Expand Up @@ -176,7 +176,7 @@ struct MemoryLoc {
/// An alias-analysis pass.
pub struct AliasAnalysis<'a> {
/// The domtree for the function.
domtree: &'a DominatorTreePreorder,
domtree: &'a DominatorTree,

/// Input state to a basic block.
block_input: FxHashMap<Block, LastStores>,
Expand All @@ -191,7 +191,7 @@ pub struct AliasAnalysis<'a> {

impl<'a> AliasAnalysis<'a> {
/// Perform an alias analysis pass.
pub fn new(func: &Function, domtree: &'a DominatorTreePreorder) -> AliasAnalysis<'a> {
pub fn new(func: &Function, domtree: &'a DominatorTree) -> AliasAnalysis<'a> {
trace!("alias analysis: input is:\n{:?}", func);
let mut analysis = AliasAnalysis {
domtree,
Expand Down Expand Up @@ -333,7 +333,7 @@ impl<'a> AliasAnalysis<'a> {
value.index(),
def_inst.index()
);
if self.domtree.dominates_inst(def_inst, inst, &func.layout) {
if self.domtree.dominates(def_inst, inst, &func.layout) {
trace!(
" -> dominates; value equiv from v{} to v{} inserted",
load_result.index(),
Expand Down
10 changes: 2 additions & 8 deletions cranelift/codegen/src/context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@

use crate::alias_analysis::AliasAnalysis;
use crate::dominator_tree::DominatorTree;
use crate::dominator_tree::DominatorTreePreorder;
use crate::egraph::EgraphPass;
use crate::flowgraph::ControlFlowGraph;
use crate::inline::{Inline, do_inlining};
Expand Down Expand Up @@ -48,9 +47,6 @@ pub struct Context {
/// Dominator tree for `func`.
pub domtree: DominatorTree,

/// Dominator tree with dominance stored implicitly via visit-order indices for `func`
domtree_preorder: DominatorTreePreorder,

/// Loop analysis of `func`.
pub loop_analysis: LoopAnalysis,

Expand Down Expand Up @@ -79,7 +75,6 @@ impl Context {
func,
cfg: ControlFlowGraph::new(),
domtree: DominatorTree::new(),
domtree_preorder: DominatorTreePreorder::new(),
loop_analysis: LoopAnalysis::new(),
compiled_code: None,
want_disasm: false,
Expand Down Expand Up @@ -319,7 +314,6 @@ impl Context {
/// Compute dominator tree.
pub fn compute_domtree(&mut self) {
self.domtree.compute(&self.func, &self.cfg);
self.domtree_preorder.compute(&self.domtree);
}

/// Compute the loop analysis.
Expand Down Expand Up @@ -349,7 +343,7 @@ impl Context {
/// by a store instruction to the same instruction (so-called
/// "store-to-load forwarding").
pub fn replace_redundant_loads(&mut self) -> CodegenResult<()> {
let mut analysis = AliasAnalysis::new(&self.func, &self.domtree_preorder);
let mut analysis = AliasAnalysis::new(&self.func, &self.domtree);
analysis.compute_and_update_aliases(&mut self.func);
Ok(())
}
Expand Down Expand Up @@ -381,7 +375,7 @@ impl Context {
);
let fisa = fisa.into();
self.compute_loop_analysis();
let mut alias_analysis = AliasAnalysis::new(&self.func, &self.domtree_preorder);
let mut alias_analysis = AliasAnalysis::new(&self.func, &self.domtree);
let mut pass = EgraphPass::new(
&mut self.func,
&self.domtree,
Expand Down
Loading