[PATCH] D12588: PeepholeOptimizer: Look through simple extracts of reg_sequence

Matt Arsenault via llvm-commits llvm-commits at lists.llvm.org
Thu Sep 3 16:27:27 PDT 2015


arsenm added inline comments.

================
Comment at: lib/CodeGen/PeepholeOptimizer.cpp:1252
@@ +1251,3 @@
+  //
+  //  => vreg3 = COPY vreg0
+  //
----------------
qcolombet wrote:
> The design of the copy rewriter is to find alternative sources within the value tracker.
> This change does not fit that scheme and looks like an ad hoc solution.
> I believe what it is missing is to teach the value tracker about sub register.
> Could you look into that direction or explain why do you think we should do it like you propose in this patch?
This all seemed like it was solving a different problem at first.

This already does seem to track sub registers correctly, it just stops the search for a better source too early.

If in findNextSource I change
      ShouldRewrite = shareSameRegisterFile(*TRI, DefRC, SubReg, SrcRC,

to only do this if the subregister index is the same, it fixes my cases. This however breaks a few AArch64 tests. The search stopping condition needs to change, but I'm not sure exactly what it should be. It's true in this case that shareSameRegisterFile, but we also want to reduce the register size by looking through the reg_sequence. 


http://reviews.llvm.org/D12588





More information about the llvm-commits mailing list