git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@217899
91177308-0d34-0410-b5e6-
96231b3b80d8
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();