[llvm-branch-commits] [clang] a3d7cee - [CodeView] Emit function types in -gline-tables-only.
Author: Amy Huang Date: 2021-01-20T12:47:35-08:00 New Revision: a3d7cee7f9bdfbe3e88e4de39a76c3d3e2690fdb URL: https://github.com/llvm/llvm-project/commit/a3d7cee7f9bdfbe3e88e4de39a76c3d3e2690fdb DIFF: https://github.com/llvm/llvm-project/commit/a3d7cee7f9bdfbe3e88e4de39a76c3d3e2690fdb.diff LOG: [CodeView] Emit function types in -gline-tables-only. This change adds function types to further differentiate between FUNC_IDs in -gline-tables-only. Size increase of object files in clang are Before: 917990 kb After: 999312 kb Bug: https://bugs.llvm.org/show_bug.cgi?id=48432 Differential Revision: https://reviews.llvm.org/D95001 Added: Modified: clang/lib/CodeGen/CGDebugInfo.cpp clang/test/CodeGenCXX/debug-info-gline-tables-only-codeview.cpp Removed: diff --git a/clang/lib/CodeGen/CGDebugInfo.cpp b/clang/lib/CodeGen/CGDebugInfo.cpp index 00606d3ae507..02dfb14ae615 100644 --- a/clang/lib/CodeGen/CGDebugInfo.cpp +++ b/clang/lib/CodeGen/CGDebugInfo.cpp @@ -2317,6 +2317,9 @@ static bool shouldOmitDefinition(codegenoptions::DebugInfoKind DebugKind, if (ES->hasExternalDefinitions(RD) == ExternalASTSource::EK_Always) return true; + // Only emit forward declarations in line tables only to keep debug info size + // small. This only applies to CodeView, since we don't emit types in DWARF + // line tables only. if (DebugKind == codegenoptions::DebugLineTablesOnly) return true; @@ -3726,7 +3729,10 @@ llvm::DISubprogram *CGDebugInfo::getObjCMethodDeclaration( llvm::DISubroutineType *CGDebugInfo::getOrCreateFunctionType(const Decl *D, QualType FnType, llvm::DIFile *F) { - if (!D || DebugKind <= codegenoptions::DebugLineTablesOnly) + // In CodeView, we emit the function types in line tables only because the + // only way to distinguish between functions is by display name and type. + if (!D || (DebugKind <= codegenoptions::DebugLineTablesOnly && + !CGM.getCodeGenOpts().EmitCodeView)) // Create fake but valid subroutine type. Otherwise -verify would fail, and // subprogram DIE will miss DW_AT_decl_file and DW_AT_decl_line fields. return DBuilder.createSubroutineType(DBuilder.getOrCreateTypeArray(None)); diff --git a/clang/test/CodeGenCXX/debug-info-gline-tables-only-codeview.cpp b/clang/test/CodeGenCXX/debug-info-gline-tables-only-codeview.cpp index 25f801737f74..27ac682c10f5 100644 --- a/clang/test/CodeGenCXX/debug-info-gline-tables-only-codeview.cpp +++ b/clang/test/CodeGenCXX/debug-info-gline-tables-only-codeview.cpp @@ -5,7 +5,6 @@ namespace NS { struct C { -public: void m() {} }; void f() {} @@ -14,17 +13,18 @@ void f() {} NS::C c; void test() { - // CHECK: ![[EMPTY:[0-9]+]] = !{} // CHECK: !DISubprogram(name: "f", scope: ![[NS:[0-9]+]], // CHECK-SAME: type: ![[F:[0-9]+]] // CHECK: ![[NS]] = !DINamespace(name: "NS", scope: null) - // CHECK: ![[F]] = !DISubroutineType(types: ![[EMPTY]]) + // CHECK: ![[F]] = !DISubroutineType(types: ![[FTYPE:[0-9]+]]) + // CHECK: ![[FTYPE]] = !{null} NS::f(); - // CHECK: !DISubprogram(name: "m", scope: ![[C:[0-9]+]], - // CHECK-SAME: type: ![[F]] + // CHECK: ![[M:[0-9]+]] = distinct !DISubprogram(name: "m", scope: ![[C:[0-9]+]], + // CHECK-SAME: type: ![[MTYPE:[0-9]+]] // CHECK: ![[C]] = !DICompositeType(tag: DW_TAG_structure_type, name: "C", // CHECK-SAME: flags: DIFlagFwdDecl // CHECK-NOT: identifier + // CHECK: ![[MTYPE]] = !DISubroutineType(types: !{{.*}}) c.m(); } ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [clang] a1be47b - [CodeView][DebugInfo] Add test case to show that linkage names are not
Author: Amy Huang Date: 2021-01-15T12:05:33-08:00 New Revision: a1be47b4771467998d7549dcd1b9f9cebdaa9af9 URL: https://github.com/llvm/llvm-project/commit/a1be47b4771467998d7549dcd1b9f9cebdaa9af9 DIFF: https://github.com/llvm/llvm-project/commit/a1be47b4771467998d7549dcd1b9f9cebdaa9af9.diff LOG: [CodeView][DebugInfo] Add test case to show that linkage names are not being added to class types in -gline-tables-only. Also changed the name of the test file for clarity. (follow up to D94639) Added: clang/test/CodeGenCXX/debug-info-gline-tables-only-codeview.cpp Modified: Removed: clang/test/CodeGenCXX/debug-info-codeview-scopes.cpp diff --git a/clang/test/CodeGenCXX/debug-info-codeview-scopes.cpp b/clang/test/CodeGenCXX/debug-info-codeview-scopes.cpp deleted file mode 100644 index f096e334a158.. --- a/clang/test/CodeGenCXX/debug-info-codeview-scopes.cpp +++ /dev/null @@ -1,34 +0,0 @@ -// RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -debug-info-kind=line-tables-only -S -emit-llvm -std=c++11 -o - %s | FileCheck --check-prefix LINUX %s -// RUN: %clang_cc1 -triple x86_64-windows-msvc -debug-info-kind=line-tables-only -gcodeview -S -emit-llvm -std=c++11 -o - %s | FileCheck --check-prefix MSVC %s - -// Check that we emit type information for function scopes in line tables for -// CodeView. - -namespace A { -void f() {} - -struct S { - static void m() {} -}; -} - -int main() { - A::f(); - A::S::m(); - return 0; - // MSVC: !{{[0-9]+}} = distinct !DISubprogram(name: "f" - // MSVC-SAME: scope: [[SCOPE1:![0-9]+]] - // MSVC-SAME: ) - // MSVC: [[SCOPE1]] = !DINamespace(name: "A", {{.*}}) - // MSVC: !{{[0-9]+}} = distinct !DISubprogram(name: "m" - // MSVC-SAME: scope: [[SCOPE2:![0-9]+]] - // MSVC-SAME: ) - // MSVC: [[SCOPE2]] = !DICompositeType(tag: DW_TAG_structure_type, - // MSVC-SAME: name: "S", - // MSVC-SAME: scope: [[SCOPE1]] - // MSVC-SAME: ) - - // LINUX-NOT: !DINamespace - // LINUX-NOT: !DICompositeType - return 0; -} diff --git a/clang/test/CodeGenCXX/debug-info-gline-tables-only-codeview.cpp b/clang/test/CodeGenCXX/debug-info-gline-tables-only-codeview.cpp new file mode 100644 index ..25f801737f74 --- /dev/null +++ b/clang/test/CodeGenCXX/debug-info-gline-tables-only-codeview.cpp @@ -0,0 +1,30 @@ +// RUN: %clang_cc1 %s -gcodeview -debug-info-kind=line-tables-only -S \ +// RUN: -emit-llvm -o - | FileCheck %s +// Checks that clang with "-gline-tables-only" with CodeView emits some debug +// info for variables and types when they appear in function scopes. + +namespace NS { +struct C { +public: + void m() {} +}; +void f() {} +} + +NS::C c; + +void test() { + // CHECK: ![[EMPTY:[0-9]+]] = !{} + // CHECK: !DISubprogram(name: "f", scope: ![[NS:[0-9]+]], + // CHECK-SAME: type: ![[F:[0-9]+]] + // CHECK: ![[NS]] = !DINamespace(name: "NS", scope: null) + // CHECK: ![[F]] = !DISubroutineType(types: ![[EMPTY]]) + NS::f(); + + // CHECK: !DISubprogram(name: "m", scope: ![[C:[0-9]+]], + // CHECK-SAME: type: ![[F]] + // CHECK: ![[C]] = !DICompositeType(tag: DW_TAG_structure_type, name: "C", + // CHECK-SAME: flags: DIFlagFwdDecl + // CHECK-NOT: identifier + c.m(); +} ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [clang] 6227069 - [DebugInfo][CodeView] Change in line tables only mode to emit type information
Author: Amy Huang Date: 2021-01-15T09:28:27-08:00 New Revision: 6227069bdce6b0c3c22f0a0c8f1aef705985125a URL: https://github.com/llvm/llvm-project/commit/6227069bdce6b0c3c22f0a0c8f1aef705985125a DIFF: https://github.com/llvm/llvm-project/commit/6227069bdce6b0c3c22f0a0c8f1aef705985125a.diff LOG: [DebugInfo][CodeView] Change in line tables only mode to emit type information for function scopes, rather than using the qualified name. In line-tables-only mode, we used to emit qualified names as the display name for functions when using CodeView. This patch changes to emitting the parent scopes instead, with forward declarations for class types. The total object file size ends up being slightly smaller than if we use the full qualified names. Differential Revision: https://reviews.llvm.org/D94639 Added: clang/test/CodeGenCXX/debug-info-codeview-scopes.cpp Modified: clang/lib/CodeGen/CGDebugInfo.cpp clang/test/CodeGenCXX/debug-info-codeview-display-name.cpp Removed: diff --git a/clang/lib/CodeGen/CGDebugInfo.cpp b/clang/lib/CodeGen/CGDebugInfo.cpp index 881ee24546c2..00606d3ae507 100644 --- a/clang/lib/CodeGen/CGDebugInfo.cpp +++ b/clang/lib/CodeGen/CGDebugInfo.cpp @@ -254,24 +254,12 @@ StringRef CGDebugInfo::getFunctionName(const FunctionDecl *FD) { FunctionTemplateSpecializationInfo *Info = FD->getTemplateSpecializationInfo(); - // Emit the unqualified name in normal operation. LLVM and the debugger can - // compute the fully qualified name from the scope chain. If we're only - // emitting line table info, there won't be any scope chains, so emit the - // fully qualified name here so that stack traces are more accurate. - // FIXME: Do this when emitting DWARF as well as when emitting CodeView after - // evaluating the size impact. - bool UseQualifiedName = DebugKind == codegenoptions::DebugLineTablesOnly && - CGM.getCodeGenOpts().EmitCodeView; - - if (!Info && FII && !UseQualifiedName) + if (!Info && FII) return FII->getName(); SmallString<128> NS; llvm::raw_svector_ostream OS(NS); - if (!UseQualifiedName) -FD->printName(OS); - else -FD->printQualifiedName(OS, getPrintingPolicy()); + FD->printName(OS); // Add any template specialization args. if (Info) { @@ -1058,7 +1046,10 @@ CGDebugInfo::getOrCreateRecordFwdDecl(const RecordType *Ty, Flags |= llvm::DINode::FlagNonTrivial; // Create the type. - SmallString<256> Identifier = getTypeIdentifier(Ty, CGM, TheCU); + SmallString<256> Identifier; + // Don't include a linkage name in line tables only. + if (CGM.getCodeGenOpts().hasReducedDebugInfo()) +Identifier = getTypeIdentifier(Ty, CGM, TheCU); llvm::DICompositeType *RetTy = DBuilder.createReplaceableCompositeType( getTagForRecord(RD), RDName, Ctx, DefUnit, Line, 0, Size, Align, Flags, Identifier); @@ -2326,6 +2317,9 @@ static bool shouldOmitDefinition(codegenoptions::DebugInfoKind DebugKind, if (ES->hasExternalDefinitions(RD) == ExternalASTSource::EK_Always) return true; + if (DebugKind == codegenoptions::DebugLineTablesOnly) +return true; + if (DebugKind > codegenoptions::LimitedDebugInfo) return false; @@ -3473,7 +3467,11 @@ void CGDebugInfo::collectFunctionDeclProps(GlobalDecl GD, llvm::DIFile *Unit, DebugKind <= codegenoptions::DebugLineTablesOnly)) LinkageName = StringRef(); - if (CGM.getCodeGenOpts().hasReducedDebugInfo()) { + // Emit the function scope in line tables only mode (if CodeView) to + // diff erentiate between function names. + if (CGM.getCodeGenOpts().hasReducedDebugInfo() || + (DebugKind == codegenoptions::DebugLineTablesOnly && + CGM.getCodeGenOpts().EmitCodeView)) { if (const NamespaceDecl *NSDecl = dyn_cast_or_null(FD->getDeclContext())) FDContext = getOrCreateNamespace(NSDecl); @@ -3482,6 +3480,8 @@ void CGDebugInfo::collectFunctionDeclProps(GlobalDecl GD, llvm::DIFile *Unit, llvm::DIScope *Mod = getParentModuleOrNull(RDecl); FDContext = getContextDescriptor(RDecl, Mod ? Mod : TheCU); } + } + if (CGM.getCodeGenOpts().hasReducedDebugInfo()) { // Check if it is a noreturn-marked function if (FD->isNoReturn()) Flags |= llvm::DINode::FlagNoReturn; diff --git a/clang/test/CodeGenCXX/debug-info-codeview-display-name.cpp b/clang/test/CodeGenCXX/debug-info-codeview-display-name.cpp index 15f625d8832d..935fded5e67c 100644 --- a/clang/test/CodeGenCXX/debug-info-codeview-display-name.cpp +++ b/clang/test/CodeGenCXX/debug-info-codeview-display-name.cpp @@ -20,11 +20,9 @@ void freefunc() { } namespace N { int b() { return 0; } -// UNQUAL-DAG: "b" -// QUAL-DAG: "N::b" +// CHECK-DAG: "b" namespace { void func() { } } -// UNQUAL-DAG: "func" -// QUAL-DAG: "N::`anonymous namespace'::func" +// CHECK-DAG: "func" }
[llvm-branch-commits] [lld] 7e13694 - [llvm-symbolizer][Windows] Add start line when searching in line table sections.
Author: Amy Huang Date: 2020-12-17T07:57:36-08:00 New Revision: 7e13694ac745f6cd4008dd354f2fcfc417b1e1e9 URL: https://github.com/llvm/llvm-project/commit/7e13694ac745f6cd4008dd354f2fcfc417b1e1e9 DIFF: https://github.com/llvm/llvm-project/commit/7e13694ac745f6cd4008dd354f2fcfc417b1e1e9.diff LOG: [llvm-symbolizer][Windows] Add start line when searching in line table sections. Fixes issue where if a line section doesn't start with a line number then the addresses at the beginning of the section don't have line numbers. For example, for a line section like this ``` 0001:0010-0014, line/column/addr entries = 1 7 0013 ! ``` a line number wouldn't be found for addresses from 10 to 12. This matches behavior when using the DIA SDK. Differential Revision: https://reviews.llvm.org/D93306 Added: lld/test/COFF/symbolizer-line-numbers.s Modified: llvm/lib/DebugInfo/PDB/Native/SymbolCache.cpp Removed: diff --git a/lld/test/COFF/symbolizer-line-numbers.s b/lld/test/COFF/symbolizer-line-numbers.s new file mode 100644 index ..679e94eb2bb0 --- /dev/null +++ b/lld/test/COFF/symbolizer-line-numbers.s @@ -0,0 +1,322 @@ +# REQUIRES: x86 +# RUN: llvm-mc -filetype=obj %s -o %t.obj -triple x86_64-windows-msvc +# RUN: lld-link -entry:main -nodefaultlib %t.obj -out:%t.exe -pdb:%t.pdb -debug +# RUN: llvm-symbolizer --obj=%t.exe --relative-address \ +# RUN: 0x1000 0x1003 0x1010 0x1013 | FileCheck %s + +# Compiled from this cpp code: +# int f1(int x) { +# int y = x + 1; +# return y; +# } +# int f2(int n) { +# return f1(n); +# } +# int main() { +# return f2(100); +# } + +.text + .def @feat.00; + .scl3; + .type 0; + .endef + .globl @feat.00 +.set @feat.00, 0 + .file "t.cpp" + .def "?f1@@YAHH@Z"; + .scl2; + .type 32; + .endef + .globl "?f1@@YAHH@Z" # -- Begin function ?f1@@YAHH@Z + .p2align4, 0x90 +"?f1@@YAHH@Z": # @"?f1@@YAHH@Z" +.Lfunc_begin0: + .cv_func_id 0 +# %bb.0:# %entry + .cv_file1 "C:\\src\\tests\\t.cpp" "E6E6D87A9021656AD44E74484F5BA421" 1 + +# CHECK: f1(int) +# CHECK-NEXT: t.cpp:2:13 + .cv_loc 0 1 2 13# t.cpp:2:13 +# kill: def $ecx killed $ecx def $rcx + leal1(%rcx), %eax + +# CHECK: f1(int) +# CHECK-NEXT: t.cpp:3:3 + .cv_loc 0 1 3 3 # t.cpp:3:3 + retq +.Ltmp0: +.Lfunc_end0: +# -- End function + .def "?f2@@YAHH@Z"; + .scl2; + .type 32; + .endef + .globl "?f2@@YAHH@Z" # -- Begin function ?f2@@YAHH@Z + .p2align4, 0x90 +"?f2@@YAHH@Z": # @"?f2@@YAHH@Z" +.Lfunc_begin1: + .cv_func_id 1 +# %bb.0:# %entry +# CHECK: f1 +# CHECK-NEXT: t.cpp:2:0 +# CHECK-NEXT: f2(int) +# CHECK-NEXT: t.cpp:6:3 + .cv_inline_site_id 2 within 1 inlined_at 1 6 10 + .cv_loc 2 1 2 13# t.cpp:2:13 +# kill: def $ecx killed $ecx def $rcx + leal1(%rcx), %eax +.Ltmp1: + .cv_loc 1 1 6 3 # t.cpp:6:3 + retq +# CHECK: f2(int) +# CHECK-NEXT: t.cpp:6:3 +.Ltmp2: +.Lfunc_end1: +# -- End function + .def main; + .scl2; + .type 32; + .endef + .globl main# -- Begin function main + .p2align4, 0x90 +main: # @main +.Lfunc_begin2: + .cv_func_id 3 +# %bb.0:# %entry + .cv_loc 3 1 9 3 # t.cpp:9:3 + movl$101, %eax + retq +.Ltmp3: +.Lfunc_end2: +# -- End function + .section.debug$S,"dr" + .p2align2 + .long 4 # Debug section magic + .long 241 + .long .Ltmp5-.Ltmp4 # Subsection size +.Ltmp4: + .short .Ltmp7-.Ltmp6 # Record length +.Ltmp6: + .short 4412# Record kind: S_COMPILE3 + .long 1 # Flags and language + .short 208 # CPUType + .short 12 # Frontend version + .short 0 + .short 0 + .short 0 + .short 12000 # Backend version + .short 0 + .short 0 + .short 0 + .asciz "clang version 12.0.0 (https://github.com/llvm/llvm-project.git e2e86f4e77ec2fd79743f4d0e94689e9668600ad)" # Null-terminated
[llvm-branch-commits] [llvm] aa7ae25 - [llvm-symbolizer] Add missing include for config.h
Author: Amy Huang Date: 2020-12-15T09:20:31-08:00 New Revision: aa7ae25613da0322c77a2a19cadd950f21e74ee2 URL: https://github.com/llvm/llvm-project/commit/aa7ae25613da0322c77a2a19cadd950f21e74ee2 DIFF: https://github.com/llvm/llvm-project/commit/aa7ae25613da0322c77a2a19cadd950f21e74ee2.diff LOG: [llvm-symbolizer] Add missing include for config.h The cmake variable LLVM_ENABLE_DIA_SDK was being used here but was undefined because config.h wasn't included. Differential Revision: https://reviews.llvm.org/D93309 Added: Modified: llvm/tools/llvm-symbolizer/llvm-symbolizer.cpp Removed: diff --git a/llvm/tools/llvm-symbolizer/llvm-symbolizer.cpp b/llvm/tools/llvm-symbolizer/llvm-symbolizer.cpp index 875432bd6705..358e0e284fca 100644 --- a/llvm/tools/llvm-symbolizer/llvm-symbolizer.cpp +++ b/llvm/tools/llvm-symbolizer/llvm-symbolizer.cpp @@ -16,6 +16,7 @@ #include "Opts.inc" #include "llvm/ADT/StringRef.h" +#include "llvm/Config/config.h" #include "llvm/DebugInfo/Symbolize/DIPrinter.h" #include "llvm/DebugInfo/Symbolize/Symbolize.h" #include "llvm/Option/Arg.h" ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [llvm] 399bc48 - [CodeView] Fix inline sites that are missing code offsets.
Author: Amy Huang Date: 2020-12-07T13:01:53-08:00 New Revision: 399bc48eccf0d983a8a4644c12ed9cc21ff33f33 URL: https://github.com/llvm/llvm-project/commit/399bc48eccf0d983a8a4644c12ed9cc21ff33f33 DIFF: https://github.com/llvm/llvm-project/commit/399bc48eccf0d983a8a4644c12ed9cc21ff33f33.diff LOG: [CodeView] Fix inline sites that are missing code offsets. When an inline site has a starting code offset of 0, we sometimes don't emit the starting offset. Bug: https://bugs.llvm.org/show_bug.cgi?id=48377 Differential Revision: https://reviews.llvm.org/D92590 Added: Modified: llvm/lib/MC/MCCodeView.cpp llvm/test/MC/COFF/cv-inline-linetable-infloop.s llvm/test/MC/COFF/cv-loc-unreachable-2.s llvm/test/MC/COFF/cv-loc-unreachable.s Removed: diff --git a/llvm/lib/MC/MCCodeView.cpp b/llvm/lib/MC/MCCodeView.cpp index 7849196432b8..3da1a9c3e331 100644 --- a/llvm/lib/MC/MCCodeView.cpp +++ b/llvm/lib/MC/MCCodeView.cpp @@ -563,10 +563,7 @@ void CodeViewContext::encodeInlineLineTable(MCAsmLayout , 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/MC/COFF/cv-inline-linetable-infloop.s b/llvm/test/MC/COFF/cv-inline-linetable-infloop.s index 3802a0eeda7e..6246623cd9be 100644 --- a/llvm/test/MC/COFF/cv-inline-linetable-infloop.s +++ b/llvm/test/MC/COFF/cv-inline-linetable-infloop.s @@ -2,7 +2,7 @@ # CHECK:InlineSiteSym { # CHECK: BinaryAnnotations [ -# CHECK:ChangeLineOffset: 1 +# CHECK:ChangeCodeOffsetAndLineOffset: {CodeOffset: 0x0, LineOffset: 1} # CHECK:ChangeCodeLength: 0x2 # CHECK: ] # CHECK:} diff --git a/llvm/test/MC/COFF/cv-loc-unreachable-2.s b/llvm/test/MC/COFF/cv-loc-unreachable-2.s index 2906622ddd7d..4e5b331dfd61 100644 --- a/llvm/test/MC/COFF/cv-loc-unreachable-2.s +++ b/llvm/test/MC/COFF/cv-loc-unreachable-2.s @@ -23,7 +23,7 @@ # CODEVIEW: S_INLINESITE [size = 26] # CODEVIEW-NEXT: inlinee = 0x1002 (do_exit), parent = 0, end = 0 -# CODEVIEW-NEXT: 0602 line 1 (+1) +# CODEVIEW-NEXT: 0B20 code 0x0 (+0x0) line 1 (+1) # CODEVIEW-NEXT: 0409 code end 0x9 (+0x9) # CODEVIEW-NEXT: 0B21 code 0xA (+0x1) line 2 (+1) # CODEVIEW-NEXT: 0B28 code 0x12 (+0x8) line 3 (+1) diff --git a/llvm/test/MC/COFF/cv-loc-unreachable.s b/llvm/test/MC/COFF/cv-loc-unreachable.s index 333fb4523f5b..f35ed3055307 100644 --- a/llvm/test/MC/COFF/cv-loc-unreachable.s +++ b/llvm/test/MC/COFF/cv-loc-unreachable.s @@ -34,7 +34,7 @@ # CODEVIEW: S_INLINESITE [size = 26] # CODEVIEW-NEXT: inlinee = 0x1002 (do_exit), parent = 0, end = 0 -# CODEVIEW-NEXT: 0602 line 1 (+1) +# CODEVIEW-NEXT: 0B20 code 0x0 (+0x0) line 1 (+1) # CODEVIEW-NEXT: 0409 code end 0x9 (+0x9) # CODEVIEW-NEXT: 0B21 code 0xA (+0x1) line 2 (+1) # CODEVIEW-NEXT: 0B28 code 0x12 (+0x8) line 3 (+1) ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [lld] efd1ec0 - Recommit "[llvm-symbolizer] Switch to using native symbolizer by default on Windows"
Author: Amy Huang Date: 2020-11-30T17:36:12-08:00 New Revision: efd1ec0dec149c4b99ab30d96edd0ef16a72380f URL: https://github.com/llvm/llvm-project/commit/efd1ec0dec149c4b99ab30d96edd0ef16a72380f DIFF: https://github.com/llvm/llvm-project/commit/efd1ec0dec149c4b99ab30d96edd0ef16a72380f.diff LOG: Recommit "[llvm-symbolizer] Switch to using native symbolizer by default on Windows" This reverts commit 1b63177a56e8cd6196778d2b90295f03e96b5800. Added: Modified: lld/test/COFF/symbolizer-inline.s llvm/docs/CommandGuide/llvm-symbolizer.rst llvm/include/llvm/DebugInfo/Symbolize/Symbolize.h llvm/lib/DebugInfo/Symbolize/Symbolize.cpp llvm/test/tools/llvm-symbolizer/pdb/pdb-columns.test llvm/test/tools/llvm-symbolizer/pdb/pdb.test llvm/tools/llvm-symbolizer/Opts.td llvm/tools/llvm-symbolizer/llvm-symbolizer.cpp Removed: diff --git a/lld/test/COFF/symbolizer-inline.s b/lld/test/COFF/symbolizer-inline.s index 7f334617fdf4..f5817897f806 100644 --- a/lld/test/COFF/symbolizer-inline.s +++ b/lld/test/COFF/symbolizer-inline.s @@ -1,7 +1,7 @@ # REQUIRES: x86 # RUN: llvm-mc -filetype=obj %s -o %t.obj -triple x86_64-windows-msvc # RUN: lld-link -entry:main -nodefaultlib %t.obj -out:%t.exe -pdb:%t.pdb -debug -# RUN: llvm-symbolizer --obj=%t.exe --use-native-pdb-reader --relative-address \ +# RUN: llvm-symbolizer --obj=%t.exe --relative-address \ # RUN: 0x1014 0x1018 0x101c 0x1023 0x1024 \ # RUN: 0x1037 0x103A 0x104B 0x104E | FileCheck %s diff --git a/llvm/docs/CommandGuide/llvm-symbolizer.rst b/llvm/docs/CommandGuide/llvm-symbolizer.rst index c5d094f9552d..f2a8d8ef6801 100644 --- a/llvm/docs/CommandGuide/llvm-symbolizer.rst +++ b/llvm/docs/CommandGuide/llvm-symbolizer.rst @@ -354,6 +354,14 @@ OPTIONS Read command-line options from response file ``. +WINDOWS/PDB SPECIFIC OPTIONS +- + +.. option:: --dia + + Use the Windows DIA SDK for symbolization. If the DIA SDK is not found, + llvm-symbolizer will fall back to the native implementation. + MACH-O SPECIFIC OPTIONS --- diff --git a/llvm/include/llvm/DebugInfo/Symbolize/Symbolize.h b/llvm/include/llvm/DebugInfo/Symbolize/Symbolize.h index 085e4bb4ccb8..1c8fa11660af 100644 --- a/llvm/include/llvm/DebugInfo/Symbolize/Symbolize.h +++ b/llvm/include/llvm/DebugInfo/Symbolize/Symbolize.h @@ -43,7 +43,7 @@ class LLVMSymbolizer { bool Demangle = true; bool RelativeAddresses = false; bool UntagAddresses = false; -bool UseNativePDBReader = false; +bool UseDIA = false; std::string DefaultArch; std::vector DsymHints; std::string FallbackDebugPath; diff --git a/llvm/lib/DebugInfo/Symbolize/Symbolize.cpp b/llvm/lib/DebugInfo/Symbolize/Symbolize.cpp index 383e2c0d3054..3eb84a141b81 100644 --- a/llvm/lib/DebugInfo/Symbolize/Symbolize.cpp +++ b/llvm/lib/DebugInfo/Symbolize/Symbolize.cpp @@ -557,11 +557,8 @@ LLVMSymbolizer::getOrCreateModuleInfo(const std::string ) { using namespace pdb; std::unique_ptr Session; - PDB_ReaderType ReaderType = PDB_ReaderType::Native; -#if LLVM_ENABLE_DIA_SDK - if (!Opts.UseNativePDBReader) -ReaderType = PDB_ReaderType::DIA; -#endif + PDB_ReaderType ReaderType = + Opts.UseDIA ? PDB_ReaderType::DIA : PDB_ReaderType::Native; if (auto Err = loadDataForEXE(ReaderType, Objects.first->getFileName(), Session)) { Modules.emplace(ModuleName, std::unique_ptr()); diff --git a/llvm/test/tools/llvm-symbolizer/pdb/pdb-columns.test b/llvm/test/tools/llvm-symbolizer/pdb/pdb-columns.test index 425d58d4d46f..a564847ef94e 100644 --- a/llvm/test/tools/llvm-symbolizer/pdb/pdb-columns.test +++ b/llvm/test/tools/llvm-symbolizer/pdb/pdb-columns.test @@ -8,8 +8,6 @@ RUN: echo 0x140006C40 >> %t.input RUN: echo 0x140006C70 >> %t.input RUN:llvm-symbolizer -obj="%p/Inputs/test-columns.exe" < %t.input \ RUN:| FileCheck %s -RUN:llvm-symbolizer -obj="%p/Inputs/test-columns.exe" -use-native-pdb-reader < %t.input \ -RUN:| FileCheck %s This tests that the symbolizer outputs column info when it is present in the pdb. diff --git a/llvm/test/tools/llvm-symbolizer/pdb/pdb.test b/llvm/test/tools/llvm-symbolizer/pdb/pdb.test index d9e42416ad56..46a1ae9814e6 100644 --- a/llvm/test/tools/llvm-symbolizer/pdb/pdb.test +++ b/llvm/test/tools/llvm-symbolizer/pdb/pdb.test @@ -6,17 +6,18 @@ RUN: echo 0x4013D0 >> %t.input RUN: echo 0x4013E0 >> %t.input RUN: echo 0x4013F0 >> %t.input RUN: echo 0x401420 >> %t.input -RUN: llvm-symbolizer -obj="%p/Inputs/test.exe" < %t.input \ +RUN: llvm-symbolizer --obj="%p/Inputs/test.exe" < %t.input \ RUN:| FileCheck %s RUN: llvm-symbolizer --obj="%p/Inputs/test.exe" --no-demangle < %t.input \ RUN:| FileCheck %s --check-prefix=CHECK-NO-DEMANGLE -Test with native pdb reader. -RUN:
[llvm-branch-commits] [lld] 8cdf492 - [llvm-symbolizer] Fix typo in llvm-symbolizer test from a previous commit.
Author: Amy Huang Date: 2020-11-30T15:08:11-08:00 New Revision: 8cdf4920c47ddd3d60bdc3298f525512d483ce65 URL: https://github.com/llvm/llvm-project/commit/8cdf4920c47ddd3d60bdc3298f525512d483ce65 DIFF: https://github.com/llvm/llvm-project/commit/8cdf4920c47ddd3d60bdc3298f525512d483ce65.diff LOG: [llvm-symbolizer] Fix typo in llvm-symbolizer test from a previous commit. (Commit was 00bbef2bb20cf212722de282e4eb9afd09ab50db) Added: Modified: lld/test/COFF/symbolizer-inline.s Removed: diff --git a/lld/test/COFF/symbolizer-inline.s b/lld/test/COFF/symbolizer-inline.s index 9cf33b5d74a3..7f334617fdf4 100644 --- a/lld/test/COFF/symbolizer-inline.s +++ b/lld/test/COFF/symbolizer-inline.s @@ -2,7 +2,7 @@ # RUN: llvm-mc -filetype=obj %s -o %t.obj -triple x86_64-windows-msvc # RUN: lld-link -entry:main -nodefaultlib %t.obj -out:%t.exe -pdb:%t.pdb -debug # RUN: llvm-symbolizer --obj=%t.exe --use-native-pdb-reader --relative-address \ -# RUN: 0x1014 0x1018 0x101c 0x1023 0x1024 | FileCheck %s +# RUN: 0x1014 0x1018 0x101c 0x1023 0x1024 \ # RUN: 0x1037 0x103A 0x104B 0x104E | FileCheck %s # Compiled from this cpp code, with modifications to add extra inline line and ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [llvm] 00bbef2 - [llvm-symbolizer] Fix native symbolization on windows for inline sites.
Author: Amy Huang Date: 2020-11-30T14:27:35-08:00 New Revision: 00bbef2bb20cf212722de282e4eb9afd09ab50db URL: https://github.com/llvm/llvm-project/commit/00bbef2bb20cf212722de282e4eb9afd09ab50db DIFF: https://github.com/llvm/llvm-project/commit/00bbef2bb20cf212722de282e4eb9afd09ab50db.diff LOG: [llvm-symbolizer] Fix native symbolization on windows for inline sites. The existing code handles this correctly and I checked that the code in NativeInlineSiteSymbol also handles this correctly, but it was wrong in the NativeFunctionSymbol code. Differential Revision: https://reviews.llvm.org/D92134 Added: Modified: lld/test/COFF/symbolizer-inline.s llvm/lib/DebugInfo/PDB/Native/NativeFunctionSymbol.cpp Removed: diff --git a/lld/test/COFF/symbolizer-inline.s b/lld/test/COFF/symbolizer-inline.s index c0db693f784c..9cf33b5d74a3 100644 --- a/lld/test/COFF/symbolizer-inline.s +++ b/lld/test/COFF/symbolizer-inline.s @@ -3,6 +3,7 @@ # RUN: lld-link -entry:main -nodefaultlib %t.obj -out:%t.exe -pdb:%t.pdb -debug # RUN: llvm-symbolizer --obj=%t.exe --use-native-pdb-reader --relative-address \ # RUN: 0x1014 0x1018 0x101c 0x1023 0x1024 | FileCheck %s +# RUN: 0x1037 0x103A 0x104B 0x104E | FileCheck %s # Compiled from this cpp code, with modifications to add extra inline line and # file changes: @@ -12,43 +13,16 @@ # return x + 1; # } # __attribute__((always_inline)) int inlinee_1(int x) { -# return inlinee_2(x) + 1; +# return inlinee_2(x) + 2; # } # int main() { -# return inlinee_1(33); +# int x = inlinee_1(33); +# int y = inlinee_2(22); +# int z = inlinee_2(11); +# return x + y + z; # } - -# CHECK: inlinee_1 -# CHECK-NEXT: C:\src\test.cpp:9:0 -# CHECK-NEXT: main -# CHECK-NEXT: C:\src\test.cpp:13:10 - -# CHECK: inlinee_1 -# CHECK-NEXT: C:\src\test.cpp:10:0 -# CHECK-NEXT: main -# CHECK-NEXT: C:\src\test.cpp:13:10 - -# CHECK: inlinee_2 -# CHECK-NEXT: C:\src\test.cpp:5:0 -# CHECK-NEXT: inlinee_1 -# CHECK-NEXT: C:\src\test.cpp:9:0 -# CHECK-NEXT: main -# CHECK-NEXT: C:\src\test.cpp:13:10 - -# CHECK: inlinee_2 -# CHECK-NEXT: C:\src\file.cpp:5:0 -# CHECK-NEXT: inlinee_1 -# CHECK-NEXT: C:\src\test.cpp:9:0 -# CHECK-NEXT: main -# CHECK-NEXT: C:\src\test.cpp:13:10 - -# CHECK: inlinee_1 -# CHECK-NEXT: C:\src\test.cpp:9:0 -# CHECK-NEXT: main -# CHECK-NEXT: C:\src\test.cpp:13:10 - - .text + .text .def @feat.00; .scl3; .type 0; @@ -65,45 +39,118 @@ main: # @main .Lfunc_begin0: .cv_func_id 0 - .cv_file1 "C:\\src\\test.cpp" "4BECA437CFE062C7D0B74B1851B65988" 1 - .cv_file 2 "C:\\src\\file.cpp" "" 1 - .cv_loc 0 1 12 0# test.cpp:12:0 + .cv_file1 "C:\\src\\test.cpp" "67680A954FC00F980188190C8D23C68E" 1 + .cv_file 2 "C:\\src\\fakefile.cpp" "" 1 + .cv_loc 0 1 9 0 # test.cpp:9:0 # %bb.0:# %entry - subq$16, %rsp - movl$0, 4(%rsp) - movl$33, 8(%rsp) + subq$32, %rsp + movl$0, 12(%rsp) + movl$33, 16(%rsp) .Ltmp0: - .cv_inline_site_id 1 within 0 inlined_at 1 13 10 - .cv_loc 1 1 9 20# test.cpp:9:20 - movl8(%rsp), %eax - .cv_loc 1 1 10 0# test.cpp:10:0 - movl%eax, 12(%rsp) + .cv_inline_site_id 1 within 0 inlined_at 1 10 11 + .cv_loc 1 1 6 20# test.cpp:6:20 + +# CHECK: inlinee_1 +# CHECK-NEXT: C:\src\test.cpp:6:0 +# CHECK-NEXT: main +# CHECK-NEXT: C:\src\test.cpp:10:11 + movl16(%rsp), %eax + +# Add a line change here. + .cv_loc 1 1 7 7 + +# CHECK: inlinee_1 +# CHECK-NEXT: C:\src\test.cpp:7:0 +# CHECK-NEXT: main +# CHECK-NEXT: C:\src\test.cpp:10:11 + movl%eax, 20(%rsp) .Ltmp1: - .cv_inline_site_id 2 within 1 inlined_at 1 9 10 - .cv_loc 2 1 5 10# test.cpp:5:10 - movl12(%rsp), %eax - .cv_loc 2 1 5 12# test.cpp:5:12 + .cv_inline_site_id 2 within 1 inlined_at 1 6 10 + .cv_loc 2 1 2 10# test.cpp:2:10 + +# CHECK: inlinee_2 +# CHECK-NEXT: C:\src\test.cpp:2:0 +# CHECK-NEXT: inlinee_1 +# CHECK-NEXT: C:\src\test.cpp:6:0 +# CHECK-NEXT: main +# CHECK-NEXT: C:\src\test.cpp:10:11 + movl20(%rsp), %eax + .cv_loc 2 1 2 12# test.cpp:2:12 addl$1, %eax - .cv_loc 2 2 5 13# file.cpp:5:13 + +# Add a file change. + .cv_loc 2 2 102 0 # fakefile.cpp:102:0 + +# CHECK: inlinee_2 +# CHECK-NEXT: C:\src\fakefile.cpp:102:0 +# CHECK-NEXT: inlinee_1 +# CHECK-NEXT: C:\src\test.cpp:6:0 +# CHECK-NEXT: main +# CHECK-NEXT: C:\src\test.cpp:10:11 nop + .Ltmp2: -
[llvm-branch-commits] [lld] 1363dfa - [CodeView] Avoid emitting empty debug globals subsection.
Author: Amy Huang Date: 2020-11-25T16:13:32-08:00 New Revision: 1363dfaf3105470e1724ed1f17c6d9c0713f442e URL: https://github.com/llvm/llvm-project/commit/1363dfaf3105470e1724ed1f17c6d9c0713f442e DIFF: https://github.com/llvm/llvm-project/commit/1363dfaf3105470e1724ed1f17c6d9c0713f442e.diff LOG: [CodeView] Avoid emitting empty debug globals subsection. In https://reviews.llvm.org/D89072 I added static const data members to the debug subsection for globals. It skipped emitting an S_CONSTANT if it didn't have a value, which meant the subsection could be empty. This patch fixes the empty subsection issue. Differential Revision: https://reviews.llvm.org/D92049 Added: lld/test/COFF/empty-subsection.s llvm/test/DebugInfo/COFF/empty-globals-subsection.ll Modified: lld/COFF/PDB.cpp llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp Removed: diff --git a/lld/COFF/PDB.cpp b/lld/COFF/PDB.cpp index 5e65eca5b9fe..36526de7796c 100644 --- a/lld/COFF/PDB.cpp +++ b/lld/COFF/PDB.cpp @@ -500,6 +500,9 @@ void PDBLinker::mergeSymbolRecords(TpiSource *source, cantFail(symData.readBytes(0, symData.getLength(), symsBuffer)); SmallVector scopes; + if (symsBuffer.empty()) +warn("empty symbols subsection in " + file->getName()); + // Iterate every symbol to check if any need to be realigned, and if so, how // much space we need to allocate for them. bool needsRealignment = false; diff --git a/lld/test/COFF/empty-subsection.s b/lld/test/COFF/empty-subsection.s new file mode 100644 index ..e573d5b57bdd --- /dev/null +++ b/lld/test/COFF/empty-subsection.s @@ -0,0 +1,20 @@ +# REQUIRES: x86 +# RUN: llvm-mc -triple=x86_64-windows-msvc -filetype=obj -o %t.obj %s +# RUN: lld-link /entry:main /debug /out:%t.exe %t.obj 2>&1 | FileCheck %s + +# CHECK: warning: empty symbols subsection + +.globl main +.Lfunc_begin0: +main: + xorl %eax, %eax + retq +.Lfunc_end0: + +.section .debug$S,"dr" + .p2align2 + .long 4 # Debug section magic + .long 241 # Symbol subsection for globals + .long .Ltmp5-.Ltmp4 # Subsection size +.Ltmp4: +.Ltmp5: diff --git a/llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp b/llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp index 4d618cf3d687..b15e750aaf85 100644 --- a/llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp +++ b/llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp @@ -2150,10 +2150,13 @@ void CodeViewDebug::collectMemberInfo(ClassInfo , if (!DDTy->getName().empty()) { Info.Members.push_back({DDTy, 0}); -// Collect static const data members. +// Collect static const data members with values. if ((DDTy->getFlags() & DINode::FlagStaticMember) == -DINode::FlagStaticMember) - StaticConstMembers.push_back(DDTy); +DINode::FlagStaticMember) { + if (DDTy->getConstant() && (isa(DDTy->getConstant()) || + isa(DDTy->getConstant( +StaticConstMembers.push_back(DDTy); +} return; } @@ -3134,7 +3137,7 @@ void CodeViewDebug::emitStaticConstMemberList() { dyn_cast_or_null(DTy->getConstant())) Value = APSInt(CFP->getValueAPF().bitcastToAPInt(), true); else - continue; + llvm_unreachable("cannot emit a constant without a value"); std::string QualifiedName = getFullyQualifiedName(Scope, DTy->getName()); diff --git a/llvm/test/DebugInfo/COFF/empty-globals-subsection.ll b/llvm/test/DebugInfo/COFF/empty-globals-subsection.ll new file mode 100644 index ..b6f3c9a752d0 --- /dev/null +++ b/llvm/test/DebugInfo/COFF/empty-globals-subsection.ll @@ -0,0 +1,29 @@ +; RUN: llc < %s | FileCheck %s + +; The debug info contains a struct with a non-const static member. +; Check that we don't emit a symbol subsection for globals. + +; CHECK-NOT: Symbol subsection for globals + +; ModuleID = 'a.cpp' +source_filename = "a.cpp" +target triple = "x86_64-pc-windows-msvc19.25.28614" + +define dso_local i32 @main() { +entry: + ret i32 0 +} + +!llvm.dbg.cu = !{!0} +!llvm.module.flags = !{!8, !9} + +!0 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus_14, file: !1, producer: "clang", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug, enums: !2, retainedTypes: !3, nameTableKind: None) +!1 = !DIFile(filename: "a.cpp", directory: "C:/path/to/test", checksumkind: CSK_MD5, checksum: "a1dbf3aabea9e8f9d1be48f60287942f") +!2 = !{} +!3 = !{!4} +!4 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "S", file: !1, line: 5, size: 32, flags: DIFlagTypePassByValue | DIFlagNonTrivial, elements: !5, identifier: ".?AU?$A@J@@") +!5 = !{!6} +!6 = !DIDerivedType(tag: DW_TAG_member, name: "x", scope: !4, file: !1, line: 6, baseType: !7, size: 32, flags: DIFlagStaticMember) +!7 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed)
[llvm-branch-commits] [lld] 1b63177 - Revert "[llvm-symbolizer] Switch to using native symbolizer by default on Windows"
Author: Amy Huang Date: 2020-11-23T16:29:45-08:00 New Revision: 1b63177a56e8cd6196778d2b90295f03e96b5800 URL: https://github.com/llvm/llvm-project/commit/1b63177a56e8cd6196778d2b90295f03e96b5800 DIFF: https://github.com/llvm/llvm-project/commit/1b63177a56e8cd6196778d2b90295f03e96b5800.diff LOG: Revert "[llvm-symbolizer] Switch to using native symbolizer by default on Windows" Breaks some asan tests on the buildbot. This reverts commit c74b427cb2a90309ee0c29df21ad1ca26390263c. Added: Modified: lld/test/COFF/symbolizer-inline.s llvm/docs/CommandGuide/llvm-symbolizer.rst llvm/include/llvm/DebugInfo/Symbolize/Symbolize.h llvm/lib/DebugInfo/Symbolize/Symbolize.cpp llvm/test/tools/llvm-symbolizer/pdb/pdb-columns.test llvm/test/tools/llvm-symbolizer/pdb/pdb.test llvm/tools/llvm-symbolizer/Opts.td llvm/tools/llvm-symbolizer/llvm-symbolizer.cpp Removed: diff --git a/lld/test/COFF/symbolizer-inline.s b/lld/test/COFF/symbolizer-inline.s index 9a032f999866..c0db693f784c 100644 --- a/lld/test/COFF/symbolizer-inline.s +++ b/lld/test/COFF/symbolizer-inline.s @@ -1,7 +1,7 @@ # REQUIRES: x86 # RUN: llvm-mc -filetype=obj %s -o %t.obj -triple x86_64-windows-msvc # RUN: lld-link -entry:main -nodefaultlib %t.obj -out:%t.exe -pdb:%t.pdb -debug -# RUN: llvm-symbolizer --obj=%t.exe --relative-address \ +# RUN: llvm-symbolizer --obj=%t.exe --use-native-pdb-reader --relative-address \ # RUN: 0x1014 0x1018 0x101c 0x1023 0x1024 | FileCheck %s # Compiled from this cpp code, with modifications to add extra inline line and diff --git a/llvm/docs/CommandGuide/llvm-symbolizer.rst b/llvm/docs/CommandGuide/llvm-symbolizer.rst index f2a8d8ef6801..c5d094f9552d 100644 --- a/llvm/docs/CommandGuide/llvm-symbolizer.rst +++ b/llvm/docs/CommandGuide/llvm-symbolizer.rst @@ -354,14 +354,6 @@ OPTIONS Read command-line options from response file ``. -WINDOWS/PDB SPECIFIC OPTIONS -- - -.. option:: --dia - - Use the Windows DIA SDK for symbolization. If the DIA SDK is not found, - llvm-symbolizer will fall back to the native implementation. - MACH-O SPECIFIC OPTIONS --- diff --git a/llvm/include/llvm/DebugInfo/Symbolize/Symbolize.h b/llvm/include/llvm/DebugInfo/Symbolize/Symbolize.h index 1c8fa11660af..085e4bb4ccb8 100644 --- a/llvm/include/llvm/DebugInfo/Symbolize/Symbolize.h +++ b/llvm/include/llvm/DebugInfo/Symbolize/Symbolize.h @@ -43,7 +43,7 @@ class LLVMSymbolizer { bool Demangle = true; bool RelativeAddresses = false; bool UntagAddresses = false; -bool UseDIA = false; +bool UseNativePDBReader = false; std::string DefaultArch; std::vector DsymHints; std::string FallbackDebugPath; diff --git a/llvm/lib/DebugInfo/Symbolize/Symbolize.cpp b/llvm/lib/DebugInfo/Symbolize/Symbolize.cpp index 3eb84a141b81..383e2c0d3054 100644 --- a/llvm/lib/DebugInfo/Symbolize/Symbolize.cpp +++ b/llvm/lib/DebugInfo/Symbolize/Symbolize.cpp @@ -557,8 +557,11 @@ LLVMSymbolizer::getOrCreateModuleInfo(const std::string ) { using namespace pdb; std::unique_ptr Session; - PDB_ReaderType ReaderType = - Opts.UseDIA ? PDB_ReaderType::DIA : PDB_ReaderType::Native; + PDB_ReaderType ReaderType = PDB_ReaderType::Native; +#if LLVM_ENABLE_DIA_SDK + if (!Opts.UseNativePDBReader) +ReaderType = PDB_ReaderType::DIA; +#endif if (auto Err = loadDataForEXE(ReaderType, Objects.first->getFileName(), Session)) { Modules.emplace(ModuleName, std::unique_ptr()); diff --git a/llvm/test/tools/llvm-symbolizer/pdb/pdb-columns.test b/llvm/test/tools/llvm-symbolizer/pdb/pdb-columns.test index a564847ef94e..425d58d4d46f 100644 --- a/llvm/test/tools/llvm-symbolizer/pdb/pdb-columns.test +++ b/llvm/test/tools/llvm-symbolizer/pdb/pdb-columns.test @@ -8,6 +8,8 @@ RUN: echo 0x140006C40 >> %t.input RUN: echo 0x140006C70 >> %t.input RUN:llvm-symbolizer -obj="%p/Inputs/test-columns.exe" < %t.input \ RUN:| FileCheck %s +RUN:llvm-symbolizer -obj="%p/Inputs/test-columns.exe" -use-native-pdb-reader < %t.input \ +RUN:| FileCheck %s This tests that the symbolizer outputs column info when it is present in the pdb. diff --git a/llvm/test/tools/llvm-symbolizer/pdb/pdb.test b/llvm/test/tools/llvm-symbolizer/pdb/pdb.test index 46a1ae9814e6..d9e42416ad56 100644 --- a/llvm/test/tools/llvm-symbolizer/pdb/pdb.test +++ b/llvm/test/tools/llvm-symbolizer/pdb/pdb.test @@ -6,18 +6,17 @@ RUN: echo 0x4013D0 >> %t.input RUN: echo 0x4013E0 >> %t.input RUN: echo 0x4013F0 >> %t.input RUN: echo 0x401420 >> %t.input -RUN: llvm-symbolizer --obj="%p/Inputs/test.exe" < %t.input \ +RUN: llvm-symbolizer -obj="%p/Inputs/test.exe" < %t.input \ RUN:| FileCheck %s RUN: llvm-symbolizer --obj="%p/Inputs/test.exe" --no-demangle < %t.input \ RUN:|
[llvm-branch-commits] [llvm] c74b427 - [llvm-symbolizer] Switch to using native symbolizer by default on Windows
Author: Amy Huang Date: 2020-11-23T15:57:08-08:00 New Revision: c74b427cb2a90309ee0c29df21ad1ca26390263c URL: https://github.com/llvm/llvm-project/commit/c74b427cb2a90309ee0c29df21ad1ca26390263c DIFF: https://github.com/llvm/llvm-project/commit/c74b427cb2a90309ee0c29df21ad1ca26390263c.diff LOG: [llvm-symbolizer] Switch to using native symbolizer by default on Windows llvm-symbolizer used to use the DIA SDK for symbolization on Windows; this patch switches to using native symbolization, which was implemented recently. Users can still make the symbolizer use DIA by adding the `-dia` flag in the LLVM_SYMBOLIZER_OPTS environment variable. Differential Revision: https://reviews.llvm.org/D91814 Added: Modified: lld/test/COFF/symbolizer-inline.s llvm/docs/CommandGuide/llvm-symbolizer.rst llvm/include/llvm/DebugInfo/Symbolize/Symbolize.h llvm/lib/DebugInfo/Symbolize/Symbolize.cpp llvm/test/tools/llvm-symbolizer/pdb/pdb-columns.test llvm/test/tools/llvm-symbolizer/pdb/pdb.test llvm/tools/llvm-symbolizer/Opts.td llvm/tools/llvm-symbolizer/llvm-symbolizer.cpp Removed: diff --git a/lld/test/COFF/symbolizer-inline.s b/lld/test/COFF/symbolizer-inline.s index c0db693f784c..9a032f999866 100644 --- a/lld/test/COFF/symbolizer-inline.s +++ b/lld/test/COFF/symbolizer-inline.s @@ -1,7 +1,7 @@ # REQUIRES: x86 # RUN: llvm-mc -filetype=obj %s -o %t.obj -triple x86_64-windows-msvc # RUN: lld-link -entry:main -nodefaultlib %t.obj -out:%t.exe -pdb:%t.pdb -debug -# RUN: llvm-symbolizer --obj=%t.exe --use-native-pdb-reader --relative-address \ +# RUN: llvm-symbolizer --obj=%t.exe --relative-address \ # RUN: 0x1014 0x1018 0x101c 0x1023 0x1024 | FileCheck %s # Compiled from this cpp code, with modifications to add extra inline line and diff --git a/llvm/docs/CommandGuide/llvm-symbolizer.rst b/llvm/docs/CommandGuide/llvm-symbolizer.rst index c5d094f9552d..f2a8d8ef6801 100644 --- a/llvm/docs/CommandGuide/llvm-symbolizer.rst +++ b/llvm/docs/CommandGuide/llvm-symbolizer.rst @@ -354,6 +354,14 @@ OPTIONS Read command-line options from response file ``. +WINDOWS/PDB SPECIFIC OPTIONS +- + +.. option:: --dia + + Use the Windows DIA SDK for symbolization. If the DIA SDK is not found, + llvm-symbolizer will fall back to the native implementation. + MACH-O SPECIFIC OPTIONS --- diff --git a/llvm/include/llvm/DebugInfo/Symbolize/Symbolize.h b/llvm/include/llvm/DebugInfo/Symbolize/Symbolize.h index 085e4bb4ccb8..1c8fa11660af 100644 --- a/llvm/include/llvm/DebugInfo/Symbolize/Symbolize.h +++ b/llvm/include/llvm/DebugInfo/Symbolize/Symbolize.h @@ -43,7 +43,7 @@ class LLVMSymbolizer { bool Demangle = true; bool RelativeAddresses = false; bool UntagAddresses = false; -bool UseNativePDBReader = false; +bool UseDIA = false; std::string DefaultArch; std::vector DsymHints; std::string FallbackDebugPath; diff --git a/llvm/lib/DebugInfo/Symbolize/Symbolize.cpp b/llvm/lib/DebugInfo/Symbolize/Symbolize.cpp index 383e2c0d3054..3eb84a141b81 100644 --- a/llvm/lib/DebugInfo/Symbolize/Symbolize.cpp +++ b/llvm/lib/DebugInfo/Symbolize/Symbolize.cpp @@ -557,11 +557,8 @@ LLVMSymbolizer::getOrCreateModuleInfo(const std::string ) { using namespace pdb; std::unique_ptr Session; - PDB_ReaderType ReaderType = PDB_ReaderType::Native; -#if LLVM_ENABLE_DIA_SDK - if (!Opts.UseNativePDBReader) -ReaderType = PDB_ReaderType::DIA; -#endif + PDB_ReaderType ReaderType = + Opts.UseDIA ? PDB_ReaderType::DIA : PDB_ReaderType::Native; if (auto Err = loadDataForEXE(ReaderType, Objects.first->getFileName(), Session)) { Modules.emplace(ModuleName, std::unique_ptr()); diff --git a/llvm/test/tools/llvm-symbolizer/pdb/pdb-columns.test b/llvm/test/tools/llvm-symbolizer/pdb/pdb-columns.test index 425d58d4d46f..a564847ef94e 100644 --- a/llvm/test/tools/llvm-symbolizer/pdb/pdb-columns.test +++ b/llvm/test/tools/llvm-symbolizer/pdb/pdb-columns.test @@ -8,8 +8,6 @@ RUN: echo 0x140006C40 >> %t.input RUN: echo 0x140006C70 >> %t.input RUN:llvm-symbolizer -obj="%p/Inputs/test-columns.exe" < %t.input \ RUN:| FileCheck %s -RUN:llvm-symbolizer -obj="%p/Inputs/test-columns.exe" -use-native-pdb-reader < %t.input \ -RUN:| FileCheck %s This tests that the symbolizer outputs column info when it is present in the pdb. diff --git a/llvm/test/tools/llvm-symbolizer/pdb/pdb.test b/llvm/test/tools/llvm-symbolizer/pdb/pdb.test index d9e42416ad56..46a1ae9814e6 100644 --- a/llvm/test/tools/llvm-symbolizer/pdb/pdb.test +++ b/llvm/test/tools/llvm-symbolizer/pdb/pdb.test @@ -6,17 +6,18 @@ RUN: echo 0x4013D0 >> %t.input RUN: echo 0x4013E0 >> %t.input RUN: echo 0x4013F0 >> %t.input RUN: echo 0x401420 >> %t.input -RUN: llvm-symbolizer
[llvm-branch-commits] [llvm] b4902bc - [NFC] remove print statement I accidentally added.
Author: Amy Huang Date: 2020-11-23T10:51:09-08:00 New Revision: b4902bcd986ddbda30a210fc320c1fd8657e5b0d URL: https://github.com/llvm/llvm-project/commit/b4902bcd986ddbda30a210fc320c1fd8657e5b0d DIFF: https://github.com/llvm/llvm-project/commit/b4902bcd986ddbda30a210fc320c1fd8657e5b0d.diff LOG: [NFC] remove print statement I accidentally added. Added: Modified: llvm/lib/DebugInfo/PDB/Native/NativeFunctionSymbol.cpp Removed: diff --git a/llvm/lib/DebugInfo/PDB/Native/NativeFunctionSymbol.cpp b/llvm/lib/DebugInfo/PDB/Native/NativeFunctionSymbol.cpp index dc4d256b614a..708ed36eb50b 100644 --- a/llvm/lib/DebugInfo/PDB/Native/NativeFunctionSymbol.cpp +++ b/llvm/lib/DebugInfo/PDB/Native/NativeFunctionSymbol.cpp @@ -121,7 +121,6 @@ NativeFunctionSymbol::findInlineFramesByVA(uint64_t VA) const { InlineSiteSym IS = cantFail(SymbolDeserializer::deserializeAs(*Start)); if (inlineSiteContainsAddress(IS, CodeOffset)) { -fprintf(stderr, "inline: %d\n", Start.offset()); // Insert frames in reverse order. SymIndexId Id = Session.getSymbolCache().getOrCreateInlineSymbol( IS, getVirtualAddress(), Modi, Start.offset()); ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [clang] be9f8fd - Add -debug-info-kind=constructor to clang release notes
Author: Amy Huang Date: 2020-02-24T10:39:54-08:00 New Revision: be9f8fdfd9af15d70b3b80535f7519588784e939 URL: https://github.com/llvm/llvm-project/commit/be9f8fdfd9af15d70b3b80535f7519588784e939 DIFF: https://github.com/llvm/llvm-project/commit/be9f8fdfd9af15d70b3b80535f7519588784e939.diff LOG: Add -debug-info-kind=constructor to clang release notes Added: Modified: clang/docs/ReleaseNotes.rst Removed: diff --git a/clang/docs/ReleaseNotes.rst b/clang/docs/ReleaseNotes.rst index 784766bc9a34..91506e1a2b25 100644 --- a/clang/docs/ReleaseNotes.rst +++ b/clang/docs/ReleaseNotes.rst @@ -175,6 +175,10 @@ Modified Compiler Flags between vector types. Synonym: ``-fno-lax-vector-conversions``. +- ``-debug-info-kind`` now has an option ``-debug-info-kind=constructor``, + which is one level below ``-debug-info-kind=limited``. This option causes + debug info for classes to be emitted only when a constructor is emitted. + New Pragmas in Clang ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [clang] a999b9d - Add support for the MS qualifiers __ptr32, __ptr64, __sptr, __uptr.
Author: Amy Huang Date: 2019-12-18T09:01:31-08:00 New Revision: a999b9dc69f88e590a61f78c10ac7db51a3a5d98 URL: https://github.com/llvm/llvm-project/commit/a999b9dc69f88e590a61f78c10ac7db51a3a5d98 DIFF: https://github.com/llvm/llvm-project/commit/a999b9dc69f88e590a61f78c10ac7db51a3a5d98.diff LOG: Add support for the MS qualifiers __ptr32, __ptr64, __sptr, __uptr. Summary: This adds parsing of the qualifiers __ptr32, __ptr64, __sptr, and __uptr and lowers them to the corresponding address space pointer for 32-bit and 64-bit pointers. (32/64-bit pointers added in https://reviews.llvm.org/D69639) A large part of this patch is making these pointers ignore the address space when doing things like overloading and casting. https://bugs.llvm.org/show_bug.cgi?id=42359 Reviewers: rnk, rsmith Subscribers: jholewinski, jvesely, nhaehnle, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D71039 Added: clang/test/CodeGen/ms-mixed-ptr-sizes.c clang/test/CodeGenCXX/mangle-ptr-size-address-space.cpp Modified: clang/include/clang/AST/Type.h clang/include/clang/Basic/AddressSpaces.h clang/lib/AST/ASTContext.cpp clang/lib/AST/ItaniumMangle.cpp clang/lib/AST/MicrosoftMangle.cpp clang/lib/Basic/Targets/AMDGPU.cpp clang/lib/Basic/Targets/NVPTX.h clang/lib/Basic/Targets/SPIR.h clang/lib/Basic/Targets/TCE.h clang/lib/Basic/Targets/X86.h clang/lib/Sema/SemaDecl.cpp clang/lib/Sema/SemaOverload.cpp clang/lib/Sema/SemaType.cpp clang/test/Sema/MicrosoftExtensions.c clang/test/SemaTemplate/address_space-dependent.cpp Removed: diff --git a/clang/include/clang/AST/Type.h b/clang/include/clang/AST/Type.h index 2968efa9b276..f7cd4945d022 100644 --- a/clang/include/clang/AST/Type.h +++ b/clang/include/clang/AST/Type.h @@ -477,7 +477,11 @@ class Qualifiers { return A == B || // Otherwise in OpenCLC v2.0 s6.5.5: every address space except // for __constant can be used as __generic. - (A == LangAS::opencl_generic && B != LangAS::opencl_constant); + (A == LangAS::opencl_generic && B != LangAS::opencl_constant) || + // Consider pointer size address spaces to be equivalent to default. + ((isPtrSizeAddressSpace(A) && B == LangAS::Default) || +(isPtrSizeAddressSpace(B) && A == LangAS::Default) || +(isPtrSizeAddressSpace(A) && isPtrSizeAddressSpace(B))); } /// Returns true if the address space in these qualifiers is equal to or diff --git a/clang/include/clang/Basic/AddressSpaces.h b/clang/include/clang/Basic/AddressSpaces.h index 2cc67474c121..faf7f303aa2d 100644 --- a/clang/include/clang/Basic/AddressSpaces.h +++ b/clang/include/clang/Basic/AddressSpaces.h @@ -42,6 +42,11 @@ enum class LangAS : unsigned { cuda_constant, cuda_shared, + // Pointer size and extension address spaces. + ptr32_sptr, + ptr32_uptr, + ptr64, + // This denotes the count of language-specific address spaces and also // the offset added to the target-specific address spaces, which are usually // specified by address space attributes __attribute__(address_space(n))). @@ -68,6 +73,11 @@ inline LangAS getLangASFromTargetAS(unsigned TargetAS) { (unsigned)LangAS::FirstTargetAddressSpace); } +inline bool isPtrSizeAddressSpace(LangAS AS) { + return (AS == LangAS::ptr32_sptr || AS == LangAS::ptr32_uptr || + AS == LangAS::ptr64); +} + } // namespace clang #endif // LLVM_CLANG_BASIC_ADDRESSSPACES_H diff --git a/clang/lib/AST/ASTContext.cpp b/clang/lib/AST/ASTContext.cpp index 1046663c7009..42b49be54df2 100644 --- a/clang/lib/AST/ASTContext.cpp +++ b/clang/lib/AST/ASTContext.cpp @@ -825,15 +825,18 @@ static const LangASMap *getAddressSpaceMap(const TargetInfo , // The fake address space map must have a distinct entry for each // language-specific address space. static const unsigned FakeAddrSpaceMap[] = { - 0, // Default - 1, // opencl_global - 3, // opencl_local - 2, // opencl_constant - 0, // opencl_private - 4, // opencl_generic - 5, // cuda_device - 6, // cuda_constant - 7 // cuda_shared +0, // Default +1, // opencl_global +3, // opencl_local +2, // opencl_constant +0, // opencl_private +4, // opencl_generic +5, // cuda_device +6, // cuda_constant +7, // cuda_shared +8, // ptr32_sptr +9, // ptr32_uptr +10 // ptr64 }; return } else { diff --git a/clang/lib/AST/ItaniumMangle.cpp b/clang/lib/AST/ItaniumMangle.cpp index 8c87c55c792a..0d567edac521 100644 --- a/clang/lib/AST/ItaniumMangle.cpp +++ b/clang/lib/AST/ItaniumMangle.cpp @@ -2301,6 +2301,16 @@ void CXXNameMangler::mangleQualifiers(Qualifiers Quals, const DependentAddressSp case
[llvm-branch-commits] [clang] 7513e66 - Address comments
Author: Amy Huang Date: 2019-12-18T09:01:31-08:00 New Revision: 7513e662d3c536c04b7bf44f68ce41cdc5eefc21 URL: https://github.com/llvm/llvm-project/commit/7513e662d3c536c04b7bf44f68ce41cdc5eefc21 DIFF: https://github.com/llvm/llvm-project/commit/7513e662d3c536c04b7bf44f68ce41cdc5eefc21.diff LOG: Address comments Added: Modified: clang/include/clang/AST/ASTContext.h clang/include/clang/AST/Type.h clang/include/clang/Basic/Attr.td clang/include/clang/Basic/AttrDocs.td clang/lib/AST/ASTContext.cpp clang/lib/AST/MicrosoftMangle.cpp clang/lib/AST/TypePrinter.cpp clang/lib/Sema/SemaDecl.cpp clang/lib/Sema/SemaOverload.cpp Removed: diff --git a/clang/include/clang/AST/ASTContext.h b/clang/include/clang/AST/ASTContext.h index 4e1d4a44bd8c..92f81eb55ed7 100644 --- a/clang/include/clang/AST/ASTContext.h +++ b/clang/include/clang/AST/ASTContext.h @@ -1155,6 +1155,10 @@ class ASTContext : public RefCountedBase { /// attribute. QualType getObjCGCQualType(QualType T, Qualifiers::GC gcAttr) const; + /// Remove the existing address space on the type if it is a pointer size + /// address space and return the type with qualifiers intact. + QualType removePtrSizeAddrSpace(QualType T) const; + /// Return the uniqued reference to the type for a \c restrict /// qualified type. /// @@ -1209,6 +1213,15 @@ class ASTContext : public RefCountedBase { const FunctionProtoType::ExceptionSpecInfo , bool AsWritten = false); + /// Get a function type and produce the equivalent function type where + /// pointer size address spaces in the return type and parameter tyeps are + /// replaced with the default address space. + QualType getFunctionTypeWithoutPtrSizes(QualType T); + + /// Determine whether two function types are the same, ignoring pointer sizes + /// in the return type and parameter types. + bool hasSameFunctionTypeIgnoringPtrSizes(QualType T, QualType U); + /// Return the uniqued reference to the type for a complex /// number with the specified element type. QualType getComplexType(QualType T) const; diff --git a/clang/include/clang/AST/Type.h b/clang/include/clang/AST/Type.h index f7cd4945d022..942564756c93 100644 --- a/clang/include/clang/AST/Type.h +++ b/clang/include/clang/AST/Type.h @@ -479,9 +479,8 @@ class Qualifiers { // for __constant can be used as __generic. (A == LangAS::opencl_generic && B != LangAS::opencl_constant) || // Consider pointer size address spaces to be equivalent to default. - ((isPtrSizeAddressSpace(A) && B == LangAS::Default) || -(isPtrSizeAddressSpace(B) && A == LangAS::Default) || -(isPtrSizeAddressSpace(A) && isPtrSizeAddressSpace(B))); + ((isPtrSizeAddressSpace(A) || A == LangAS::Default) && +(isPtrSizeAddressSpace(B) || B == LangAS::Default)); } /// Returns true if the address space in these qualifiers is equal to or diff --git a/clang/include/clang/Basic/Attr.td b/clang/include/clang/Basic/Attr.td index 47d9e641b178..286807ec779f 100644 --- a/clang/include/clang/Basic/Attr.td +++ b/clang/include/clang/Basic/Attr.td @@ -2975,22 +2975,22 @@ def Win64 : IgnoredAttr { def Ptr32 : TypeAttr { let Spellings = [Keyword<"__ptr32">]; - let Documentation = [Undocumented]; + let Documentation = [Ptr32Docs]; } def Ptr64 : TypeAttr { let Spellings = [Keyword<"__ptr64">]; - let Documentation = [Undocumented]; + let Documentation = [Ptr64Docs]; } def SPtr : TypeAttr { let Spellings = [Keyword<"__sptr">]; - let Documentation = [Undocumented]; + let Documentation = [SPtrDocs]; } def UPtr : TypeAttr { let Spellings = [Keyword<"__uptr">]; - let Documentation = [Undocumented]; + let Documentation = [UPtrDocs]; } def MSInheritance : InheritableAttr { diff --git a/clang/include/clang/Basic/AttrDocs.td b/clang/include/clang/Basic/AttrDocs.td index c632e52b28d1..3fa6993a5fd0 100644 --- a/clang/include/clang/Basic/AttrDocs.td +++ b/clang/include/clang/Basic/AttrDocs.td @@ -3139,6 +3139,44 @@ Since it is not widely used and has been removed from OpenCL 2.1, it is ignored by Clang. }]; } + +def Ptr32Docs : Documentation { + let Category = DocCatType; + let Content = [{ +The ``__ptr32`` qualifier represents a native pointer on a 32-bit system. On a +64-bit system, a pointer with ``__ptr32`` is extended to a 64-bit pointer. The +``__sptr`` and ``__uptr`` qualifiers can be used to specify whether the pointer +is sign extended or zero extended. This qualifier is enabled under +``-fms-extensions``. + }]; +} + +def Ptr64Docs : Documentation { + let Category = DocCatType; + let Content = [{ +The ``__ptr64`` qualifier represents a native pointer on a 64-bit system. On a +32-bit system, a ``__ptr64`` pointer is truncated to a 32-bit pointer. This
[llvm-branch-commits] [llvm] 840845a - Fix merge issues in b288f7d6bb8fdd21d27ba755302db194c181fdaf
Author: Amy Huang Date: 2019-11-13T14:14:23-08:00 New Revision: 840845a1eeae2dc039600ef826de21347edd53ef URL: https://github.com/llvm/llvm-project/commit/840845a1eeae2dc039600ef826de21347edd53ef DIFF: https://github.com/llvm/llvm-project/commit/840845a1eeae2dc039600ef826de21347edd53ef.diff LOG: Fix merge issues in b288f7d6bb8fdd21d27ba755302db194c181fdaf Added: Modified: llvm/lib/CodeGen/MachineFunction.cpp llvm/unittests/CodeGen/MachineInstrTest.cpp Removed: diff --git a/llvm/lib/CodeGen/MachineFunction.cpp b/llvm/lib/CodeGen/MachineFunction.cpp index 5470422be4d3..e6133bab468c 100644 --- a/llvm/lib/CodeGen/MachineFunction.cpp +++ b/llvm/lib/CodeGen/MachineFunction.cpp @@ -822,12 +822,9 @@ try_next:; return FilterID; } -void MachineFunction::moveCallSiteInfo(const MachineInstr *Old, - const MachineInstr *New) { - assert(New->isCall() && "Call site info refers only to call instructions!"); - - CallSiteInfoMap::iterator CSIt = getCallSiteInfo(Old); - if (CSIt == CallSitesInfo.end()) +void MachineFunction::updateCallSiteInfo(const MachineInstr *Old, + const MachineInstr *New) { + if (!Target.Options.EnableDebugEntryValues || Old == New) return; assert(Old->isCall() && (!New || New->isCall()) && diff --git a/llvm/unittests/CodeGen/MachineInstrTest.cpp b/llvm/unittests/CodeGen/MachineInstrTest.cpp index 977495e0086d..f09ea7baad16 100644 --- a/llvm/unittests/CodeGen/MachineInstrTest.cpp +++ b/llvm/unittests/CodeGen/MachineInstrTest.cpp @@ -139,11 +139,8 @@ class BogusTargetMachine : public LLVMTargetMachine { BogusSubtarget ST; }; -static MCAsmInfo AsmInfo = MCAsmInfo(); - -std::unique_ptr createMCContext() { - return std::make_unique( - , nullptr, nullptr, nullptr, nullptr, false); +std::unique_ptr createMCContext(MCAsmInfo *AsmInfo) { + return std::make_unique(AsmInfo, nullptr, nullptr, nullptr, false); } std::unique_ptr createTargetMachine() { @@ -378,7 +375,8 @@ TEST(MachineInstrExtraInfo, AddExtraInfo) { 0, nullptr, nullptr, nullptr, 0, nullptr}; auto MI = MF->CreateMachineInstr(MCID, DebugLoc()); - auto MC = createMCContext(); + auto MAI = MCAsmInfo(); + auto MC = createMCContext(); auto MMO = MF->getMachineMemOperand(MachinePointerInfo(), MachineMemOperand::MOLoad, 8, 8); SmallVector MMOs; @@ -424,7 +422,8 @@ TEST(MachineInstrExtraInfo, ChangeExtraInfo) { 0, nullptr, nullptr, nullptr, 0, nullptr}; auto MI = MF->CreateMachineInstr(MCID, DebugLoc()); - auto MC = createMCContext(); + auto MAI = MCAsmInfo(); + auto MC = createMCContext(); auto MMO = MF->getMachineMemOperand(MachinePointerInfo(), MachineMemOperand::MOLoad, 8, 8); SmallVector MMOs; @@ -460,7 +459,8 @@ TEST(MachineInstrExtraInfo, RemoveExtraInfo) { 0, nullptr, nullptr, nullptr, 0, nullptr}; auto MI = MF->CreateMachineInstr(MCID, DebugLoc()); - auto MC = createMCContext(); + auto MAI = MCAsmInfo(); + auto MC = createMCContext(); auto MMO = MF->getMachineMemOperand(MachinePointerInfo(), MachineMemOperand::MOLoad, 8, 8); SmallVector MMOs; ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [llvm] b288f7d - [codeview] Fix for PR43479
Author: Amy Huang Date: 2019-11-13T10:29:42-08:00 New Revision: b288f7d6bb8fdd21d27ba755302db194c181fdaf URL: https://github.com/llvm/llvm-project/commit/b288f7d6bb8fdd21d27ba755302db194c181fdaf DIFF: https://github.com/llvm/llvm-project/commit/b288f7d6bb8fdd21d27ba755302db194c181fdaf.diff LOG: [codeview] Fix for PR43479 Summary: Add instruction marker to MachineInstr ExtraInfo. This does almost the same thing as Pre/PostInstrSymbols, except that it doesn't create a label until printing instructions. This allows for labels to be put around instructions that are deleted/duplicated somewhere. Use this marker to track heap alloc site call instructions. Reviewers: rnk Subscribers: MatzeB, hiraditya, llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D69536 cherry picked from 742043047c973999eac7734e53f7872973933f24 with some modifications. Added: Modified: llvm/include/llvm/CodeGen/MachineFunction.h llvm/include/llvm/CodeGen/MachineInstr.h llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.h llvm/lib/CodeGen/MachineFunction.cpp llvm/lib/CodeGen/MachineInstr.cpp llvm/lib/CodeGen/SelectionDAG/FastISel.cpp llvm/lib/CodeGen/SelectionDAG/ScheduleDAGSDNodes.cpp llvm/test/CodeGen/X86/label-heapallocsite.ll llvm/test/CodeGen/X86/taildup-heapallocsite.ll llvm/unittests/CodeGen/MachineInstrTest.cpp Removed: diff --git a/llvm/include/llvm/CodeGen/MachineFunction.h b/llvm/include/llvm/CodeGen/MachineFunction.h index 201c126ee52e..9c610b2960f8 100644 --- a/llvm/include/llvm/CodeGen/MachineFunction.h +++ b/llvm/include/llvm/CodeGen/MachineFunction.h @@ -787,10 +787,9 @@ class MachineFunction { /// /// This is allocated on the function's allocator and so lives the life of /// the function. - MachineInstr::ExtraInfo * - createMIExtraInfo(ArrayRef MMOs, -MCSymbol *PreInstrSymbol = nullptr, -MCSymbol *PostInstrSymbol = nullptr); + MachineInstr::ExtraInfo *createMIExtraInfo( + ArrayRef MMOs, MCSymbol *PreInstrSymbol = nullptr, + MCSymbol *PostInstrSymbol = nullptr, MDNode *HeapAllocMarker = nullptr); /// Allocate a string and populate it with the given external symbol name. const char *createExternalSymbolName(StringRef Name); @@ -934,14 +933,6 @@ class MachineFunction { return CodeViewAnnotations; } - /// Record heapallocsites - void addCodeViewHeapAllocSite(MachineInstr *I, MDNode *MD); - - ArrayRef> - getCodeViewHeapAllocSites() const { -return CodeViewHeapAllocSites; - } - /// Return a reference to the C++ typeinfo for the current function. const std::vector () const { return TypeInfos; diff --git a/llvm/include/llvm/CodeGen/MachineInstr.h b/llvm/include/llvm/CodeGen/MachineInstr.h index c82c5b137507..fa532ec831fd 100644 --- a/llvm/include/llvm/CodeGen/MachineInstr.h +++ b/llvm/include/llvm/CodeGen/MachineInstr.h @@ -137,19 +137,23 @@ class MachineInstr /// This has to be defined eagerly due to the implementation constraints of /// `PointerSumType` where it is used. class ExtraInfo final - : TrailingObjects { + : TrailingObjects { public: static ExtraInfo *create(BumpPtrAllocator , ArrayRef MMOs, MCSymbol *PreInstrSymbol = nullptr, - MCSymbol *PostInstrSymbol = nullptr) { + MCSymbol *PostInstrSymbol = nullptr, + MDNode *HeapAllocMarker = nullptr) { bool HasPreInstrSymbol = PreInstrSymbol != nullptr; bool HasPostInstrSymbol = PostInstrSymbol != nullptr; + bool HasHeapAllocMarker = HeapAllocMarker != nullptr; auto *Result = new (Allocator.Allocate( - totalSizeToAlloc( - MMOs.size(), HasPreInstrSymbol + HasPostInstrSymbol), + totalSizeToAlloc( + MMOs.size(), HasPreInstrSymbol + HasPostInstrSymbol, + HasHeapAllocMarker), alignof(ExtraInfo))) - ExtraInfo(MMOs.size(), HasPreInstrSymbol, HasPostInstrSymbol); + ExtraInfo(MMOs.size(), HasPreInstrSymbol, HasPostInstrSymbol, +HasHeapAllocMarker); // Copy the actual data into the trailing objects. std::copy(MMOs.begin(), MMOs.end(), @@ -160,6 +164,8 @@ class MachineInstr if (HasPostInstrSymbol) Result->getTrailingObjects()[HasPreInstrSymbol] = PostInstrSymbol; + if (HasHeapAllocMarker) +Result->getTrailingObjects()[0] = HeapAllocMarker; return Result; } @@ -178,6 +184,10 @@ class MachineInstr : nullptr; } +MDNode *getHeapAllocMarker() const { + return HasHeapAllocMarker ? getTrailingObjects()[0] : nullptr; +} +