OSDN Git Service

[RegisterCoalescer] Don't set read-undef in pruneValues, only clear
authorMikael Holmen <mikael.holmen@ericsson.com>
Thu, 12 Oct 2017 06:21:28 +0000 (06:21 +0000)
committerMikael Holmen <mikael.holmen@ericsson.com>
Thu, 12 Oct 2017 06:21:28 +0000 (06:21 +0000)
commitf799d906ab66d40da8918620145f9c326784e7f6
tree864b2aff0943cd2de07ce6c0e16de073b7e06081
parent58658afbec9d484721152cd267c6759c5d6f3551
[RegisterCoalescer] Don't set read-undef in pruneValues, only clear

Summary:
The comments in the code said

 // Remove <def,read-undef> flags. This def is now a partial redef.

but the code didn't just remove read-undef, it could introduce new ones which
could cause errors.

E.g. if we have something like

%vreg1<def> = IMPLICIT_DEF
%vreg2:subreg1<def, read-undef> = op %vreg3, %vreg4
%vreg2:subreg2<def> = op %vreg6, %vreg7

and we merge %vreg1 and %vreg2 then we should not set undef on the second subreg
def, which the old code did.

Now we solve this by actually do what the code comment says. We remove
read-undef flags rather than remove or introduce them.

Reviewers: qcolombet, MatzeB

Reviewed By: MatzeB

Subscribers: llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@315564 91177308-0d34-0410-b5e6-96231b3b80d8
lib/CodeGen/RegisterCoalescer.cpp
test/CodeGen/MIR/X86/simple-register-allocation-read-undef.mir [new file with mode: 0644]