[PATCH] D41463: [CodeGen] Add a new pass to sink Copy instructions after RA

Francis Visoiu Mistrih via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jan 24 12:01:13 PST 2018


thegameg added a comment.

Thanks for working on this! I've seen a few 1-2% improvements on arm64 with this enabled and I think it solves one of the issue that has been frequently raised with shrink-wrapping.

Few questions / concerns:

- Is there anything preventing us to sink this even deeper than "one of the successors"? I think we should go further with this instead of special casing this particular issue.
- If we end up doing that, I think this pass should sink more than just COPYs. Is going further with this and having a generic Post-RA Sink pass what you're planning to do?
- I wonder if we could improve MachineSink to be scheduled both pre and post RA.
- If that's not suitable, should we build some kind of infrastructure where we can merge both pre and post RA Sink passes and re-use the algorithms while only changing the constraints?

I'm just throwing ideas out here, since this feels a little bit special cased to the shrink-wrapping issue, while it could (and from what I understand, it already does) catch some even more interesting opportunities.



================
Comment at: lib/CodeGen/MachineSink.cpp:970
+getSingleLiveInSuccBB(MachineBasicBlock &CurBB,
+                      SmallVector<MachineBasicBlock *, 2> &SinkableBBs,
+                      unsigned Reg, const TargetRegisterInfo *TRI) {
----------------
You can use an `ArrayRef<MachineBasicBlock *>` here.


================
Comment at: lib/CodeGen/MachineSink.cpp:1002
+
+bool PostRAMachineSinking::tryToSinkCopy(MachineBasicBlock *CurBB,
+                                         MachineFunction &MF,
----------------
You can use a reference for things that are never null.


================
Comment at: test/DebugInfo/X86/dbg-value-transfer-order.ll:1
-; RUN: llc < %s | FileCheck %s
+; RUN: llc < %s -disable-postra-machine-sink | FileCheck %s
 
----------------
Just curious: what happened here? Is some debug info missing after this pass?


https://reviews.llvm.org/D41463





More information about the llvm-commits mailing list