Add alternative coalescing algorithm under a flag.
authorJakob Stoklund Olesen <stoklund@2pi.dk>
Sun, 16 Sep 2012 02:15:36 +0000 (02:15 +0000)
committerJakob Stoklund Olesen <stoklund@2pi.dk>
Sun, 16 Sep 2012 02:15:36 +0000 (02:15 +0000)
commitc722ae7a2b470e544ce570692ef3b109449d69ec
tree4c5d7a9d22c06c38fc3ea4342bc41f49ae740e1e
parent2131eb48875c7059eb04f0a324321e1e15e6597e
Add alternative coalescing algorithm under a flag.

The live range of an SSA value forms a sub-tree of the dominator tree.
That means the live ranges of two values overlap if and only if the def
of one value lies within the live range of the other.

This can be used to simplify the interference checking a bit: Visit each
def in the two registers about to be joined. Check for interference
against the value that is live in the other register at the def point
only. It is not necessary to scan the set of overlapping live ranges,
this interference check can be done while computing the value mapping
required for the final live range join.

The new algorithm is prepared to handle more complicated conflict
resolution - We can allow overlapping live ranges with different values
as long as the differing lanes are undef or unused in the other
register.

The implementation in this patch doesn't do that yet, it creates code
that is nearly identical to the old algorithm's, except:

- The new stripCopies() function sees through multiple copies while
  the old RegistersDefinedFromSameValue() only can handle one.

- There are a few rare cases where the new algorithm can erase an
  IMPLICIT_DEF instuction that RegistersDefinedFromSameValue() couldn't
  handle.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@163991 91177308-0d34-0410-b5e6-96231b3b80d8
lib/CodeGen/RegisterCoalescer.cpp