Merge pull request #2564 from cfallin/load-coalesce-bug

machinst lowering: update inst color when scanning across branch to allow more load-op merging.
This commit is contained in:
Chris Fallin
2021-01-11 12:06:29 -08:00
committed by GitHub
2 changed files with 17 additions and 4 deletions

View File

@@ -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 {

View File

@@ -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
}