[PATCH] D48102: Improve handling of COPY instructions with identical value numbers

Tim Renouf via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jun 21 10:16:01 PDT 2018


tpr added a comment.

Here's what I've found so far.

Here is some of the code (two separate blocks, but the first one is the only predecessor of the second one):

  656B	  %217.sub0:vreg_128 = COPY %46:sgpr_32
  720B	  %188:vreg_128 = COPY %217:vreg_128
  816B	  %172:vreg_128 = IMPLICIT_DEF
  
  1568B	  %185:vreg_128 = COPY %188:vreg_128
  1600B	  %172:vreg_128 = COPY %185:vreg_128

We're trying to coalesce this:

  1200B	%217:vreg_128 = COPY %172:vreg_128

At 1600, we have that situation where it sets CR_Erase and Identical. %172 is a copy of %185 is a copy of %188 is a copy of %217 defined at 656r, and it's the same value of %217 that is live and reaches 1600.

My current theory is that that condition is not strong enough: we have a different value of %172 at 816, and it is "in the way", in the sense that, once we have merged, the value defined at 656r no longer reaches 1600. Then the extendToIndices for L00000004 goes wrong because it attaches the use at 1648B to the implicit_def at 816r.

But I'm not sure what the stronger condition should be.

I can give you this test case, so I'll email it over.


Repository:
  rL LLVM

https://reviews.llvm.org/D48102





More information about the llvm-commits mailing list