Add encodings to the instructions in LICM's generated preheaders.

When LICM generates a preheader, it needs to add encodings to the
instructions it generates, since it runs after legalization.
This commit is contained in:
Dan Gohman
2018-11-12 05:13:43 -08:00
committed by Benjamin Bouvier
parent c7bc1b7c56
commit 641771ac6a
9 changed files with 54 additions and 8 deletions

View File

@@ -33,12 +33,13 @@ impl SubTest for TestLICM {
}
fn run(&self, func: Cow<Function>, context: &Context) -> SubtestResult<()> {
let isa = context.isa.expect("LICM needs an ISA");
let mut comp_ctx = cranelift_codegen::Context::for_function(func.into_owned());
comp_ctx.flowgraph();
comp_ctx.compute_loop_analysis();
comp_ctx
.licm(context.flags_or_isa())
.licm(isa)
.map_err(|e| pretty_error(&comp_ctx.func, context.isa, Into::into(e)))?;
let text = comp_ctx.func.display(context.isa).to_string();