diff --git a/cranelift/codegen/src/legalizer/mod.rs b/cranelift/codegen/src/legalizer/mod.rs index c96f24e9b3..5377783544 100644 --- a/cranelift/codegen/src/legalizer/mod.rs +++ b/cranelift/codegen/src/legalizer/mod.rs @@ -174,8 +174,8 @@ pub fn legalize_function(func: &mut ir::Function, cfg: &mut ControlFlowGraph, is // Try legalizing `isplit` and `vsplit` instructions, which could not previously be legalized. for inst in pending_splits { - //pos.goto_inst(inst); - //legalize_inst(inst, &mut pos, cfg, isa); + pos.goto_inst(inst); + legalize_inst(inst, &mut pos, cfg, isa); } // Now that we've lowered all br_tables, we don't need the jump tables anymore. diff --git a/cranelift/filetests/filetests/isa/x86/legalize-isplit-backwards.clif b/cranelift/filetests/filetests/isa/x86/legalize-isplit-backwards.clif new file mode 100644 index 0000000000..43881fe09e --- /dev/null +++ b/cranelift/filetests/filetests/isa/x86/legalize-isplit-backwards.clif @@ -0,0 +1,24 @@ +test compile +target x86_64 + +function u0:0(i128) -> i64, i64 fast { +; check: ebb0(v4: i64 [%rdi], v5: i64 [%rsi], v8: i64 [%rbp]): +ebb0(v0: i128): + jump ebb2 + +ebb1: + ; When this `isplit` is legalized, the bnot below is not yet legalized, + ; so there isn't a corresponding `iconcat` yet. We should try legalization + ; for this `isplit` again once all instrucions have been legalized. + v2, v3 = isplit.i128 v1 + ; return v6, v7 + return v2, v3 + +ebb2: + ; check: v6 = bnot.i64 v4 + ; check: v2 -> v6 + ; check: v7 = bnot.i64 v5 + ; check: v3 -> v7 + v1 = bnot.i128 v0 + jump ebb1 +}