[PATCH] D23210: [MachineSinking, RFC] Sink insert_subreg, subreg_to_reg, and reg_sequence instructions

Wei Mi via llvm-commits llvm-commits at lists.llvm.org
Fri Aug 5 09:57:49 PDT 2016


wmi created this revision.
wmi added reviewers: qcolombet, MatzeB.
wmi added subscribers: llvm-commits, davidxl.
wmi set the repository for this revision to rL LLVM.

In https://llvm.org/bugs/show_bug.cgi?id=28852, we saw a testcase for which machineSinking was blocked by subreg_to_reg so high cost operation cannot be moved to cold place.

The limitation about "insert_subreg, subreg_to_reg, and reg_sequence" was to make them close to the source and make them easier to coalesce. Will the coalesce indicated here happen at register coalescing or register allocation? Is the limitation still valid considering it was added at 2010 and register coalescing and allocation has gone through a lot of changes?  

I did some testing to remove the restriction on x86, for spec2000, I got 1% improvement for three benchmarks: gap, vortex, perlbmk. no regressions seen.
For internal benchmarks, I got 2% improvement for one benchmark and 1% for another. no regressions seen.   

Repository:
  rL LLVM

https://reviews.llvm.org/D23210

Files:
  lib/Target/X86/X86InstrInfo.cpp
  lib/Target/X86/X86InstrInfo.h

Index: lib/Target/X86/X86InstrInfo.h
===================================================================
--- lib/Target/X86/X86InstrInfo.h
+++ lib/Target/X86/X86InstrInfo.h
@@ -214,6 +214,7 @@
 
   bool isReallyTriviallyReMaterializable(const MachineInstr &MI,
                                          AliasAnalysis *AA) const override;
+  bool shouldSink(const MachineInstr &MI) const override;
   void reMaterialize(MachineBasicBlock &MBB, MachineBasicBlock::iterator MI,
                      unsigned DestReg, unsigned SubIdx,
                      const MachineInstr &Orig,
Index: lib/Target/X86/X86InstrInfo.cpp
===================================================================
--- lib/Target/X86/X86InstrInfo.cpp
+++ lib/Target/X86/X86InstrInfo.cpp
@@ -2768,6 +2768,8 @@
   return false;
 }
 
+bool X86InstrInfo::shouldSink(const MachineInstr &MI) const { return true; }
+
 void X86InstrInfo::reMaterialize(MachineBasicBlock &MBB,
                                  MachineBasicBlock::iterator I,
                                  unsigned DestReg, unsigned SubIdx,


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D23210.66968.patch
Type: text/x-patch
Size: 1075 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160805/1e9f2fe5/attachment.bin>


More information about the llvm-commits mailing list