Index: lib/CodeGen/AsmPrinter/DwarfDebug.cpp =================================================================== --- lib/CodeGen/AsmPrinter/DwarfDebug.cpp +++ lib/CodeGen/AsmPrinter/DwarfDebug.cpp @@ -1006,8 +1006,8 @@ DebugHandlerBase::beginInstruction(MI); assert(CurMI); - // Check if source location changes, but ignore DBG_VALUE locations. - if (MI->isDebugValue()) + // Check if source location changes, but ignore DBG_VALUE and CFI locations. + if (MI->isDebugValue() || MI->isCFIInstruction()) return; const DebugLoc &DL = MI->getDebugLoc(); if (DL == PrevInstLoc) Index: test/DebugInfo/Generic/no-cfi-loc.ll =================================================================== --- test/DebugInfo/Generic/no-cfi-loc.ll +++ test/DebugInfo/Generic/no-cfi-loc.ll @@ -0,0 +1,25 @@ +; RUN: %llc_dwarf -filetype=asm -use-unknown-locations < %s | FileCheck %s +; CHECK-NOT: .loc 1 0 0 + +define void @foo() !dbg !6 { +entry: + call void @bar(), !dbg !8 + ret void, !dbg !9 +} + +declare void @bar() + +!llvm.dbg.cu = !{!0} +!llvm.module.flags = !{!3, !4} +!llvm.ident = !{!5} + +!0 = distinct !DICompileUnit(language: DW_LANG_C99, file: !1, producer: "clang version 4.0.0 (trunk 288778)", isOptimized: false, runtimeVersion: 0, emissionKind: LineTablesOnly, enums: !2) +!1 = !DIFile(filename: "t.c", directory: "/home/probinson/projects/scratch") +!2 = !{} +!3 = !{i32 2, !"Dwarf Version", i32 4} +!4 = !{i32 2, !"Debug Info Version", i32 3} +!5 = !{!"clang version 4.0.0 (trunk 288778)"} +!6 = distinct !DISubprogram(name: "foo", scope: !1, file: !1, line: 2, type: !7, isLocal: false, isDefinition: true, scopeLine: 2, flags: DIFlagPrototyped, isOptimized: false, unit: !0, variables: !2) +!7 = !DISubroutineType(types: !2) +!8 = !DILocation(line: 3, column: 2, scope: !6) +!9 = !DILocation(line: 4, column: 1, scope: !6)