[PATCH] D30751: [MachineCopyForwarding] Add new pass to do register COPY forwarding at end of register allocation.
Hal Finkel via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Mar 8 12:19:45 PST 2017
hfinkel added a comment.
In https://reviews.llvm.org/D30751#695793, @gberry wrote:
> In https://reviews.llvm.org/D30751#695783, @hfinkel wrote:
>
> > High-level question: Why does the register allocator not do this on its own?
>
>
> I'm not sure I can fully answer that question, but doing this during register allocation could have the down-side of extending live ranges resulting in a worse allocation. Doing it in a pass just after register allocation allows it to be more conservative/opportunistic and not impact e.g. the amount of spilling.
Okay. If it only makes sense as a fallback strategy, not something that would otherwise affect how the allocation is performed, this seems like the logical way to do it.
> If instead you're asking, why not just append this code at the end of register allocation, the only reason is based on previous feedback from Quentin that this should be a separate pass.
Makes sense.
================
Comment at: test/CodeGen/PowerPC/fma-mutate.ll:17
; CHECK: @foo3
-; CHECK: xsnmsubadp [[REG:[0-9]+]], {{[0-9]+}}, [[REG]]
+; CHECK: fmr [[REG:[0-9]+]], [[REG2:[0-9]+]]
+; CHECK: xsnmsubadp [[REG]], {{[0-9]+}}, [[REG2]]
----------------
gberry wrote:
> hfinkel wrote:
> > Is this an improvement?
> The fmr is not new, I just added it to get the second register number. Here are the full diffs before/after this change for this test:
>
>
> ```
> fmr 3, 1
> addi 3, 3, .LCPI0_0 at toc@l
> lfs 2, 0(3)
> - xsnmsubadp 3, 2, 3
> + xsnmsubadp 3, 2, 1
> xsmuldp 4, 0, 0
> xsmaddmdp 4, 3, 2
> xsmuldp 0, 0, 4
> ```
>
Okay, thanks!
https://reviews.llvm.org/D30751
More information about the llvm-commits
mailing list