[PATCH] D32398: Bring back the ability opt out of padding zero-byte functions by not providing a nop instruction.

Daniel Sanders via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Apr 25 07:40:30 PDT 2017


This revision was automatically updated to reflect the committed changes.
Closed by commit rL301311: Bring back the ability opt out of padding zero-byte functions by not providing… (authored by dsanders).

Changed prior to commit:
  https://reviews.llvm.org/D32398?vs=96306&id=96556#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D32398

Files:
  llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp


Index: llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
===================================================================
--- llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
+++ llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
@@ -1068,8 +1068,13 @@
                           (TT.isOSWindows() && TT.isOSBinFormatCOFF()))) {
     MCInst Noop;
     MF->getSubtarget().getInstrInfo()->getNoop(Noop);
-    OutStreamer->AddComment("avoids zero-length function");
-    OutStreamer->EmitInstruction(Noop, getSubtargetInfo());
+
+    // Targets can opt-out of emitting the noop here by leaving the opcode
+    // unspecified.
+    if (Noop.getOpcode()) {
+      OutStreamer->AddComment("avoids zero-length function");
+      OutStreamer->EmitInstruction(Noop, getSubtargetInfo());
+    }
   }
 
   const Function *F = MF->getFunction();


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D32398.96556.patch
Type: text/x-patch
Size: 834 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170425/846001b6/attachment.bin>


More information about the llvm-commits mailing list