Alias analysis: refactor for use by other driver loops. (#5380)

* Alias analysis: refactor for use by other driver loops.

This PR pulls the core of the alias analysis infrastructure into a
`process_inst()` method that operates on a single instruction, and
allows another compiler pass to apply store-to-load forwarding and
redundant-load elimination interleaved with other work. The existing
behavior remains unchanged; the pass's toplevel loop calls this
extracted method.

This refactor is a prerequisite for using the alias analysis as part of
a refactored egraph-based optimization framework.

* Review feedback: remove unneeded mut.
This commit is contained in:
Chris Fallin
2022-12-06 10:30:02 -08:00
committed by GitHub
parent 4a0cefb1aa
commit feaa7ca75f
2 changed files with 141 additions and 123 deletions

View File

@@ -365,8 +365,8 @@ 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(&mut self.func, &self.domtree);
analysis.compute_and_update_aliases();
let mut analysis = AliasAnalysis::new(&self.func, &self.domtree);
analysis.compute_and_update_aliases(&mut self.func);
Ok(())
}