OSDN Git Service

PeepholeOptimizer: Do not form PHI with subreg arguments
authorMatthias Braun <matze@braunis.de>
Thu, 11 Jan 2018 21:57:03 +0000 (21:57 +0000)
committerMatthias Braun <matze@braunis.de>
Thu, 11 Jan 2018 21:57:03 +0000 (21:57 +0000)
commitd65aefc0e874817dd7054756438abb7cb81daf9a
treef66cfd9df1524e5b8931265f6a784ab6d6990d9b
parent5431b562d297124829a4204801bd95cf3828c3cb
PeepholeOptimizer: Do not form PHI with subreg arguments

When replacing a PHI the PeepholeOptimizer currently takes the register
class of the register at the first operand. This however is not correct
if this argument has a subregister index.

As there is currently no API to query the register class resulting from
applying a subregister index to all registers in a class, we can only
abort in these cases and not perform the transformation.

This changes findNextSource() to require the end of all copy chains to
not use a subregister if there is any PHI in the chain. I had to rewrite
the overly complicated inner loop there to have a good place to insert
the new check.

This fixes https://llvm.org/PR33071 (aka rdar://32262041)

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@322313 91177308-0d34-0410-b5e6-96231b3b80d8
lib/CodeGen/PeepholeOptimizer.cpp
test/CodeGen/ARM/peephole-phi.mir [new file with mode: 0644]