diff --git a/cranelift/codegen/src/machinst/lower.rs b/cranelift/codegen/src/machinst/lower.rs index 46b5fc1685..28e4edd0c7 100644 --- a/cranelift/codegen/src/machinst/lower.rs +++ b/cranelift/codegen/src/machinst/lower.rs @@ -683,10 +683,6 @@ impl<'func, I: VCodeInst> Lower<'func, I> { has_side_effect, value_needed, ); - // Skip lowering branches; these are handled separately. - if self.f.dfg[inst].opcode().is_branch() { - continue; - } // Update scan state to color prior to this inst (as we are scanning // backward). @@ -699,6 +695,12 @@ impl<'func, I: VCodeInst> Lower<'func, I> { self.cur_scan_entry_color = Some(entry_color); } + // Skip lowering branches; these are handled separately + // (see `lower_clif_branches()` below). + if self.f.dfg[inst].opcode().is_branch() { + continue; + } + // Normal instruction: codegen if the instruction is side-effecting // or any of its outputs its used. if has_side_effect || value_needed { diff --git a/cranelift/filetests/filetests/isa/x64/load-op.clif b/cranelift/filetests/filetests/isa/x64/load-op.clif index 6570a798c3..8fefaf6d42 100644 --- a/cranelift/filetests/filetests/isa/x64/load-op.clif +++ b/cranelift/filetests/filetests/isa/x64/load-op.clif @@ -59,3 +59,14 @@ block0(v0: i64, v1: i64): ; nextln: movq 0(%rax,%rdi,1), %rsi ; nextln: movq %rsi, %rax } + +function %merge_scalar_to_vector(i64) -> i32x4 { +block0(v0: i64): + v1 = load.i32 v0 + v2 = scalar_to_vector.i32x4 v1 + ; check: movss 0(%rdi), %xmm0 + + jump block1 +block1: + return v2 +}