From 374e06bbce96aeb135c7b52b67140bde98c69af0 Mon Sep 17 00:00:00 2001 From: Owen Anderson Date: Tue, 16 Sep 2014 20:28:00 +0000 Subject: [PATCH] Add back a fallback case for targets that do not or cannot implement getNoopForMachoTarget(). git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@217899 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/CodeGen/AsmPrinter/AsmPrinter.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/CodeGen/AsmPrinter/AsmPrinter.cpp b/lib/CodeGen/AsmPrinter/AsmPrinter.cpp index b26d8d6f101..4eb289afc18 100644 --- a/lib/CodeGen/AsmPrinter/AsmPrinter.cpp +++ b/lib/CodeGen/AsmPrinter/AsmPrinter.cpp @@ -802,7 +802,11 @@ void AsmPrinter::EmitFunctionBody() { MCInst Noop; TM.getSubtargetImpl()->getInstrInfo()->getNoopForMachoTarget(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.EmitInstruction(Noop, getSubtargetInfo()); } const Function *F = MF->getFunction();