[PATCH] D48064: [CodeGen][shrinkWrapping] Implement the no-shrink-wrap function attribute.

Simon Dardis via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jun 12 02:25:00 PDT 2018


sdardis created this revision.
sdardis added a reviewer: efriedma.
Herald added a reviewer: javed.absar.

Counterpart to https://reviews.llvm.org/D47829.


Repository:
  rL LLVM

https://reviews.llvm.org/D48064

Files:
  lib/CodeGen/ShrinkWrap.cpp
  test/CodeGen/AArch64/no-shrink-wrap.ll


Index: test/CodeGen/AArch64/no-shrink-wrap.ll
===================================================================
--- /dev/null
+++ test/CodeGen/AArch64/no-shrink-wrap.ll
@@ -0,0 +1,13 @@
+; RUN: llc < %s -mtriple=aarch64-linux-gnu -O3 -o - 2>&1 -debug | FileCheck %s
+
+; Test the no-shrink-wrap attribute.
+
+; CHECK-NOT: Nothing to shrink-wrap
+
+define void @m() #0 {
+entry:
+  ret void
+}
+
+attributes #0 = { "no-shrink-wrap"="true" }
+
Index: lib/CodeGen/ShrinkWrap.cpp
===================================================================
--- lib/CodeGen/ShrinkWrap.cpp
+++ lib/CodeGen/ShrinkWrap.cpp
@@ -584,6 +584,11 @@
 bool ShrinkWrap::isShrinkWrapEnabled(const MachineFunction &MF) {
   const TargetFrameLowering *TFI = MF.getSubtarget().getFrameLowering();
 
+  if (MF.getFunction()
+          .getFnAttribute("no-shrink-wrap")
+          .getValueAsString() == "true")
+    return false;
+
   switch (EnableShrinkWrapOpt) {
   case cl::BOU_UNSET:
     return TFI->enableShrinkWrapping(MF) &&


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D48064.150903.patch
Type: text/x-patch
Size: 1006 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180612/9e5160a3/attachment.bin>


More information about the llvm-commits mailing list