Insert copies to support a value being used as multiple return values.

When one value is used multiple times for separate return values, we
need to copy it to produce a new value, so that each value can be
allocated a different register.
This commit is contained in:
Dan Gohman
2018-10-19 11:09:39 -07:00
committed by Benjamin Bouvier
parent 5ea6c57b95
commit 05c0b3bdd1
2 changed files with 47 additions and 2 deletions

View File

@@ -0,0 +1,13 @@
test regalloc
target x86_64
; Return the same value twice. This needs a copy so that each value can be
; allocated its own register.
function %multiple_returns() -> i64, i64 {
ebb0:
v2 = iconst.i64 0
return v2, v2
}
; check: v2 = iconst.i64 0
; check: v3 = copy v2
; check: return v2, v3