[PATCH] D40758: PeepholeOptimizer: Do not form PHI with subreg operands

Matthias Braun via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Dec 1 16:53:46 PST 2017


MatzeB created this revision.
Herald added subscribers: javed.absar, mcrosier.

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)


Repository:
  rL LLVM

https://reviews.llvm.org/D40758

Files:
  lib/CodeGen/PeepholeOptimizer.cpp
  test/CodeGen/ARM/peephole-phi.mir

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D40758.125246.patch
Type: text/x-patch
Size: 4634 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20171202/905f05b3/attachment.bin>


More information about the llvm-commits mailing list