Merge pull request #2473 from cfallin/fix-lowering

Fix lowering instruction-sinking (load-merging) bug.
This commit is contained in:
Chris Fallin
2020-12-03 15:56:50 -08:00
committed by GitHub
2 changed files with 16 additions and 0 deletions

View File

@@ -913,6 +913,7 @@ impl<'func, I: VCodeInst> Lower<'func, I> {
// the code-motion. // the code-motion.
if self.cur_scan_entry_color.is_some() if self.cur_scan_entry_color.is_some()
&& self.value_uses[val] == 1 && self.value_uses[val] == 1
&& self.value_lowered_uses[val] == 0
&& self.num_outputs(src_inst) == 1 && self.num_outputs(src_inst) == 1
&& self && self
.side_effect_inst_entry_colors .side_effect_inst_entry_colors

View File

@@ -44,3 +44,18 @@ block0(v0: i64, v1: i8):
; nextln: addl %esi, %r12d ; nextln: addl %esi, %r12d
return v3 return v3
} }
function %no_merge_if_lookback_use(i64, i64) -> i64 {
block0(v0: i64, v1: i64):
v2 = load.i64 v0
v3 = iadd.i64 v2, v0
store.i64 v3, v1
v4 = load.i64 v3
return v4
; check: movq 0(%rdi), %r12
; nextln: movq %r12, %r13
; nextln: addq %rdi, %r13
; nextln: movq %r13, 0(%rsi)
; nextln: movq 0(%r12,%rdi,1), %r12
; nextln: movq %r12, %rax
}