Propagate affinities for EBB arguments.

A priory, an EBB argument value only gets an affinity if it is used
directly by a non-ghost instruction. A use by a branch passing arguments
to an EBB doesn't count.

When an EBB argument value does have an affinity, the values passed by
all the predecessors must also have affinities. This can cause EBB
argument values to get affinities recursively.

- Add a second pass to the liveness computation for propagating EBB
  argument affinities, possibly recursively.
- Verify EBB argument affinities correctly: A value passed to a branch
  must have an affinity only if the corresponding EBB argument value in
  the destination has an affinity.
This commit is contained in:
Jakob Stoklund Olesen
2017-06-29 10:30:26 -07:00
parent cd1503eced
commit 6d34476cd6
3 changed files with 87 additions and 2 deletions

View File

@@ -63,3 +63,18 @@ ebb1(v10: i32):
v11 = call fn0(v10)
return v11
}
; Pass an EBB argument as a jump argument.
function %jumpebb(i32, i32) -> i32 {
fn0 = function %foo(i32) -> i32
ebb0(v1: i32, v2: i32):
brnz v1, ebb1(v1, v2)
jump ebb1(v2, v1)
ebb1(v10: i32, v11: i32):
jump ebb2(v10, v11)
ebb2(v20: i32, v21: i32):
return v21
}