[RegisterCoalescer] Fixed inconsistent followCopyChain with subreg
authorTim Renouf <tpr.llvm@botech.co.uk>
Thu, 26 Jul 2018 21:27:34 +0000 (21:27 +0000)
committerTim Renouf <tpr.llvm@botech.co.uk>
Thu, 26 Jul 2018 21:27:34 +0000 (21:27 +0000)
commitc0a44791e750ed46d374f7acaeb0fad07122dff1
tree632ab9ef6e4760534ea4537558e6a7c529d981ed
parentb572f6421296e7688973014d253e46c54fd64ba3
[RegisterCoalescer] Fixed inconsistent followCopyChain with subreg

Summary:
The behavior of followCopyChain with a subreg depends on the order in
which subranges appear in a live interval, which is bad.

This commit fixes that, and allows the copy chain to continue only if
all matching subranges that are not undefined take us to the same def.

I don't have a test for this; the reproducer I had on my branch with
various other local changes does not reproduce the problem on upstream
llvm. Also that reproducer was an ll test; attempting to convert it to a
mir test made the subranges appear in a different order and hid the
problem.

However I would argue that the old behavior was obviously wrong
and needs fixing.

Subscribers: MatzeB, qcolombet, llvm-commits

Differential Revision: https://reviews.llvm.org/D49535

Change-Id: Iee7936ef305918f3b498ac432e2cf651ae5cc2df
llvm-svn: 338070
llvm/lib/CodeGen/RegisterCoalescer.cpp