diff --git a/llvm/lib/MC/MCCodeView.cpp b/llvm/lib/MC/MCCodeView.cpp --- a/llvm/lib/MC/MCCodeView.cpp +++ b/llvm/lib/MC/MCCodeView.cpp @@ -563,10 +563,7 @@ int LineDelta = CurSourceLoc.Line - LastSourceLoc.Line; unsigned EncodedLineDelta = encodeSignedNumber(LineDelta); unsigned CodeDelta = computeLabelDiff(Layout, LastLabel, Loc.getLabel()); - if (CodeDelta == 0 && LineDelta != 0) { - compressAnnotation(BinaryAnnotationsOpCode::ChangeLineOffset, Buffer); - compressAnnotation(EncodedLineDelta, Buffer); - } else if (EncodedLineDelta < 0x8 && CodeDelta <= 0xf) { + if (EncodedLineDelta < 0x8 && CodeDelta <= 0xf) { // The ChangeCodeOffsetAndLineOffset combination opcode is used when the // encoded line delta uses 3 or fewer set bits and the code offset fits // in one nibble. diff --git a/llvm/test/DebugInfo/COFF/inline-site-syms.ll b/llvm/test/DebugInfo/COFF/inline-site-syms.ll new file mode 100644 --- /dev/null +++ b/llvm/test/DebugInfo/COFF/inline-site-syms.ll @@ -0,0 +1,50 @@ +; RUN: llc -mtriple=x86_64-windows-msvc -filetype=obj %s -o %t.o +; RUN: llvm-pdbutil dump -symbols %t.o | FileCheck %s + +; This LL file was generated by running +; clang -cc1 -triple x86_64-windows-msvc -gcodeview +; on the following code: +; -debug-info-kind=line-tables-only -emit-obj +; int test(int x) { +; auto f = [](int x) { +; return x * 100; +; }; +; return f(x); +; } + +; Test that an inline site with a starting code offset of 0 contains +; that code offset in the inline site symbol. +; CHECK: S_INLINESITE [size = 20] +; CHECK-NEXT: inlinee ={{.*}} (test(int)::(anonymous class):: +; CHECK-NEXT: code 0x0 (+0x0) line 1 (+1) +; CHECK-NEXT: code end 0x3 (+0x3) + +; ModuleID = 't.cpp' +source_filename = "t.cpp" +target datalayout = "e-m:w-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" +target triple = "x86_64-unknown-windows-msvc" + +define dso_local i32 @"?test@@YAHH@Z"(i32 %x) local_unnamed_addr !dbg !7 { +entry: + %mul.i = mul nsw i32 %x, 100, !dbg !10 + ret i32 %mul.i, !dbg !13 +} + +!llvm.dbg.cu = !{!0} +!llvm.module.flags = !{!3, !4, !5} +!llvm.ident = !{!6} + +!0 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus_14, file: !1, producer: "clang version 12.0.0 (https://github.com/llvm/llvm-project.git d45cf3789d141ab8b623cdb3585dbf3075eb1b4c)", isOptimized: true, runtimeVersion: 0, emissionKind: LineTablesOnly, enums: !2, nameTableKind: None) +!1 = !DIFile(filename: "", directory: "C:\\testpath") +!2 = !{} +!3 = !{i32 2, !"CodeView", i32 1} +!4 = !{i32 2, !"Debug Info Version", i32 3} +!5 = !{i32 1, !"wchar_size", i32 2} +!6 = !{!"clang version 12.0.0 (https://github.com/llvm/llvm-project.git d45cf3789d141ab8b623cdb3585dbf3075eb1b4c)"} +!7 = distinct !DISubprogram(name: "test", scope: !8, file: !8, line: 1, type: !9, scopeLine: 1, flags: DIFlagPrototyped, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !0, retainedNodes: !2) +!8 = !DIFile(filename: "t.cpp", directory: "C:\\src\\tests\\sbox-integration\\small-repro-1", checksumkind: CSK_MD5, checksum: "58386de68a85e3992bf5f17550990d68") +!9 = !DISubroutineType(types: !2) +!10 = !DILocation(line: 3, column: 14, scope: !11, inlinedAt: !12) +!11 = distinct !DISubprogram(name: "test(int)::(anonymous class)::operator()", scope: !8, file: !8, line: 2, type: !9, scopeLine: 2, flags: DIFlagPrototyped, spFlags: DISPFlagLocalToUnit | DISPFlagDefinition | DISPFlagOptimized, unit: !0, retainedNodes: !2) +!12 = distinct !DILocation(line: 5, column: 10, scope: !7) +!13 = !DILocation(line: 5, column: 3, scope: !7)