OSDN Git Service

[RegisterCoalescer] dst register's live interval needs to be updated when
authorWei Mi <wmi@google.com>
Tue, 8 Jan 2019 00:26:11 +0000 (00:26 +0000)
committerWei Mi <wmi@google.com>
Tue, 8 Jan 2019 00:26:11 +0000 (00:26 +0000)
commita2285277c7f39de3d43a5f0ed73e95d32d431418
tree7a48f5bf02cf60ad197039974d1497f0019cf562
parent20767d1ad4d80359460dd6d15b7c1ef09005287c
[RegisterCoalescer] dst register's live interval needs to be updated when
merging a src register in ToBeUpdated set.

This is to fix PR40061 related with https://reviews.llvm.org/rL339035.

In https://reviews.llvm.org/rL339035, live interval of source pseudo register
in rematerialized copy may be saved in ToBeUpdated set and its update may be
postponed.

In PR40061, %t2 = %t1 is rematerialized and %t1 is added into toBeUpdated set
to postpone its live interval update. After the rematerialization, the live
interval of %t1 is larger than necessary. Then %t1 is merged into %t3 and %t1
gets removed. After the merge, %t3 contains live interval larger than necessary.
Because %t3 is not in toBeUpdated set, its live interval is not updated after
register coalescing and it will break some assumption in regalloc.

The patch requires the live interval of destination register in a merge to be
updated if the source register is in ToBeUpdated.

Differential revision: https://reviews.llvm.org/D55867

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@350586 91177308-0d34-0410-b5e6-96231b3b80d8
lib/CodeGen/RegisterCoalescer.cpp
test/CodeGen/X86/late-remat-update-2.mir [new file with mode: 0644]