diff options
Diffstat (limited to 'lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.cpp')
-rw-r--r-- | lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.cpp | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.cpp b/lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.cpp index 847355c50d..75a34a6ec6 100644 --- a/lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.cpp +++ b/lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.cpp @@ -726,15 +726,20 @@ void X86ATTAsmPrinter::printMachineInstruction(const MachineInstr *MI) { ++EmittedInsts; if (TAI->doesSupportDebugInformation()) { - static DebugLoc PrevDL = DebugLoc::getUnknownLoc(); - DebugLoc CurDL = MI->getDebugLoc(); + const Function *F = MF->getFunction(); - if (!CurDL.isInvalid() && !CurDL.isUnknown() && PrevDL != CurDL) { - DebugLocTuple DLT = MF->getDebugLocTuple(CurDL); - printLabel(DW->RecordSourceLine(DLT.Line, DLT.Col, DLT.Src)); - } + // FIXME: Support more than '-Os'. + if (F->hasFnAttr(Attribute::OptimizeForSize)) { + static DebugLoc PrevDL = DebugLoc::getUnknownLoc(); + DebugLoc CurDL = MI->getDebugLoc(); + + if (!CurDL.isUnknown() && PrevDL != CurDL) { + DebugLocTuple DLT = MF->getDebugLocTuple(CurDL); + printLabel(DW->RecordSourceLine(DLT.Line, DLT.Col, DLT.Src)); + } - PrevDL = CurDL; + PrevDL = CurDL; + } } // Call the autogenerated instruction printer routines. |