[PATCH] D14156: [X86] Enable shrink-wrapping by default

Quentin Colombet via llvm-commits llvm-commits at lists.llvm.org
Wed Oct 28 13:11:29 PDT 2015


qcolombet created this revision.
qcolombet added reviewers: chandlerc, RKSimon, spatel, nadav.
qcolombet added a subscriber: llvm-commits.
qcolombet set the repository for this revision to rL LLVM.

Hi,

This patch enables shrink-wrapping by default for x86.
Both Chandler and I have tested shrink-wrapping and no correctness problems came out or runtime regressions.
Although the gain may be small, the code looks nicer with shrink-wrapping enabled and the performance could just be better.

Finally, I’ve run the gdb test suite with and without shrink-wrapping enabled for an optimized compiler and the results were identical.

For the record shrink-wrapping was introduced after this review:
http://reviews.llvm.org/D9210

More information on Shrink-Wrapping:
http://lists.llvm.org/pipermail/llvm-dev/2015-May/085220.html

OK to commit?

Thanks,
-Quentin

Repository:
  rL LLVM

http://reviews.llvm.org/D14156

Files:
  lib/Target/X86/X86FrameLowering.h
  test/CodeGen/X86/avx-win64.ll
  test/CodeGen/X86/tail-opts.ll

Index: test/CodeGen/X86/tail-opts.ll
===================================================================
--- test/CodeGen/X86/tail-opts.ll
+++ test/CodeGen/X86/tail-opts.ll
@@ -277,8 +277,8 @@
 
 ; CHECK-LABEL: foo:
 ; CHECK:        callq func
-; CHECK-NEXT: .LBB4_2:
 ; CHECK-NEXT:   popq
+; CHECK-NEXT: .LBB4_2:
 ; CHECK-NEXT:   ret
 
 define void @foo(i1* %V) nounwind {
Index: test/CodeGen/X86/avx-win64.ll
===================================================================
--- test/CodeGen/X86/avx-win64.ll
+++ test/CodeGen/X86/avx-win64.ll
@@ -8,8 +8,8 @@
 ; Verify that callee-saved registers are not being used.
 
 ; CHECK: f___vyf
-; CHECK: pushq %rbp
 ; CHECK: vmovmsk
+; CHECK: pushq %rbp
 ; CHECK: vmovaps %ymm{{.*}}(%r
 ; CHECK: vmovaps %ymm{{.*}}(%r
 ; CHECK: call
Index: lib/Target/X86/X86FrameLowering.h
===================================================================
--- lib/Target/X86/X86FrameLowering.h
+++ lib/Target/X86/X86FrameLowering.h
@@ -125,6 +125,11 @@
   /// \p MBB will be correctly handled by the target.
   bool canUseAsEpilogue(const MachineBasicBlock &MBB) const override;
 
+  /// Returns true if the target will correctly handle shrink wrapping.
+  bool enableShrinkWrapping(const MachineFunction &MF) const override {
+    return true;
+  }
+
 private:
   uint64_t calculateMaxStackAlign(const MachineFunction &MF) const;
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D14156.38681.patch
Type: text/x-patch
Size: 1366 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20151028/a6f85917/attachment.bin>


More information about the llvm-commits mailing list