diff --git a/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp b/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp --- a/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp +++ b/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp @@ -1987,7 +1987,7 @@ // We have an explicit location, different from the previous location. // Don't repeat a line-0 record, but otherwise emit the new location. // (The new location might be an explicit line 0, which we do emit.) - if (DL.getLine() == 0 && LastAsmLine == 0) + if (DL.getLine() == 0 && LastAsmLine != 0) return; unsigned Flags = 0; if (DL == PrologEndLoc) { diff --git a/llvm/test/CodeGen/X86/stack-protector.ll b/llvm/test/CodeGen/X86/stack-protector.ll --- a/llvm/test/CodeGen/X86/stack-protector.ll +++ b/llvm/test/CodeGen/X86/stack-protector.ll @@ -4060,23 +4060,19 @@ entry: ; LINUX-I386-LABEL: test32: ; LINUX-I386: .loc 1 4 2 prologue_end -; LINUX-I386: .loc 1 0 0 -; LINUX-I386-NEXT: calll __stack_chk_fail +; LINUX-I386: calll __stack_chk_fail ; LINUX-X64-LABEL: test32: ; LINUX-X64: .loc 1 4 2 prologue_end -; LINUX-X64: .loc 1 0 0 -; LINUX-X64-NEXT: callq __stack_chk_fail +; LINUX-X64: callq __stack_chk_fail ; LINUX-KERNEL-X64-LABEL: test32: ; LINUX-KERNEL-X64: .loc 1 4 2 prologue_end -; LINUX-KERNEL-X64: .loc 1 0 0 -; LINUX-KERNEL-X64-NEXT: callq __stack_chk_fail +; LINUX-KERNEL-X64: callq __stack_chk_fail ; OPENBSD-AMD64-LABEL: test32: ; OPENBSD-AMD64: .loc 1 4 2 prologue_end -; OPENBSD-AMD64: .loc 1 0 0 -; OPENBSD-AMD64-NEXT: movl +; OPENBSD-AMD64: movl ; OPENBSD-AMD64-NEXT: callq __stack_smash_handler %0 = alloca [5 x i8], align 1 ret void, !dbg !9 diff --git a/llvm/test/DebugInfo/MIR/X86/debug-loc-0.mir b/llvm/test/DebugInfo/MIR/X86/debug-loc-0.mir --- a/llvm/test/DebugInfo/MIR/X86/debug-loc-0.mir +++ b/llvm/test/DebugInfo/MIR/X86/debug-loc-0.mir @@ -3,7 +3,6 @@ # RUN: llc -start-before=machine-cp -O2 -filetype=asm -mtriple=x86_64-apple-macosx10.9.0 -o - %s | FileCheck %s # CHECK: Ltmp0: -# CHECK: .loc 1 0 0 prologue_end # CHECK-NOT: .loc 1 0 0 # CHECK: .loc 1 37 1 diff --git a/llvm/test/DebugInfo/X86/dbg-prolog-end.ll b/llvm/test/DebugInfo/X86/dbg-prolog-end.ll --- a/llvm/test/DebugInfo/X86/dbg-prolog-end.ll +++ b/llvm/test/DebugInfo/X86/dbg-prolog-end.ll @@ -26,7 +26,6 @@ declare void @llvm.dbg.declare(metadata, metadata, metadata) nounwind readnone ;CHECK-LABEL: main: -;CHECK: .loc 1 0 0 prologue_end define i32 @main() nounwind ssp !dbg !6 { entry: diff --git a/llvm/test/DebugInfo/X86/tail-merge.ll b/llvm/test/DebugInfo/X86/tail-merge.ll --- a/llvm/test/DebugInfo/X86/tail-merge.ll +++ b/llvm/test/DebugInfo/X86/tail-merge.ll @@ -27,7 +27,6 @@ ; CHECK: .loc 1 8 10 ; CHECK: callq bar ; CHECK: [[TAIL]]: -; CHECK: .loc 1 0 ; CHECK: addl [[REG]], %eax ; CHECK: .loc 1 9 3 diff --git a/llvm/test/DebugInfo/debugline-no-prologue_end.ll b/llvm/test/DebugInfo/debugline-no-prologue_end.ll new file mode 100644 --- /dev/null +++ b/llvm/test/DebugInfo/debugline-no-prologue_end.ll @@ -0,0 +1,41 @@ +; RUN: llc -march=arm64 -filetype=obj -O0 %s -o - | llvm-dwarfdump -debug-line - | FileCheck %s +; CHECK-NOT: 0x{{.*}} 0 0 1 0 is_stmt prologue_end + +; ModuleID = 'debugline-no-prologue_end.c' +source_filename = "debugline-no-prologue_end.c" +target datalayout = "e-m:e-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128" +target triple = "arm64" + +@.str = private unnamed_addr constant [7 x i8] c"Hello\0A\00", align 1 + +; Function Attrs: noinline nounwind optnone +define dso_local i32 @main() #0 !dbg !7 { +entry: + %retval = alloca i32, align 4 + store i32 0, i32* %retval, align 4 + %call = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0)), !dbg !11 + ret i32 0, !dbg !12 +} + +declare dso_local i32 @printf(i8*, ...) #1 + +attributes #0 = { noinline nounwind optnone "correctly-rounded-divide-sqrt-fp-math"="false" "disable-tail-calls"="false" "frame-pointer"="non-leaf" "less-precise-fpmad"="false" "min-legal-vector-width"="0" "no-infs-fp-math"="false" "no-jump-tables"="false" "no-nans-fp-math"="false" "no-signed-zeros-fp-math"="false" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="generic" "target-features"="+neon" "unsafe-fp-math"="false" "use-soft-float"="false" } +attributes #1 = { "correctly-rounded-divide-sqrt-fp-math"="false" "disable-tail-calls"="false" "frame-pointer"="non-leaf" "less-precise-fpmad"="false" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "no-signed-zeros-fp-math"="false" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="generic" "target-features"="+neon" "unsafe-fp-math"="false" "use-soft-float"="false" } + +!llvm.dbg.cu = !{!0} +!llvm.module.flags = !{!3, !4, !5} +!llvm.ident = !{!6} + +!0 = distinct !DICompileUnit(language: DW_LANG_C99, file: !1, producer: "clang version 11.0.0 (https://github.com/llvm/llvm-project.git bd87c6bce1c30cc089ffdea5e0f3cf5407ed37c5)", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug, enums: !2, splitDebugInlining: false, nameTableKind: None) +!1 = !DIFile(filename: "debugline-no-prologue_end.c", directory: "/home/bft/Jaydeep/llvm_all/debug/llvm-project/build/bin") +!2 = !{} +!3 = !{i32 7, !"Dwarf Version", i32 4} +!4 = !{i32 2, !"Debug Info Version", i32 3} +!5 = !{i32 1, !"wchar_size", i32 4} +!6 = !{!"clang version 11.0.0 (https://github.com/llvm/llvm-project.git bd87c6bce1c30cc089ffdea5e0f3cf5407ed37c5)"} +!7 = distinct !DISubprogram(name: "main", scope: !1, file: !1, line: 2, type: !8, scopeLine: 3, spFlags: DISPFlagDefinition, unit: !0, retainedNodes: !2) +!8 = !DISubroutineType(types: !9) +!9 = !{!10} +!10 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed) +!11 = !DILocation(line: 4, column: 4, scope: !7) +!12 = !DILocation(line: 5, column: 4, scope: !7)