[lld] e03c7e3 - [lld] Add test to check for timer output
Amy Huang via llvm-commits
llvm-commits at lists.llvm.org
Thu Sep 16 11:37:20 PDT 2021
Author: Amy Huang
Date: 2021-09-16T11:36:46-07:00
New Revision: e03c7e367adb8f228332e3c2ef8f45484597b719
URL: https://github.com/llvm/llvm-project/commit/e03c7e367adb8f228332e3c2ef8f45484597b719
DIFF: https://github.com/llvm/llvm-project/commit/e03c7e367adb8f228332e3c2ef8f45484597b719.diff
LOG: [lld] Add test to check for timer output
This test checks that timers are working and printing as expected.
I also seem to have changed the order of the timers in my globals refactoring
patch, so I fixed it here.
Differential Revision: https://reviews.llvm.org/D109904
Added:
lld/test/COFF/timers.ll
Modified:
lld/COFF/COFFLinkerContext.cpp
lld/COFF/COFFLinkerContext.h
Removed:
################################################################################
diff --git a/lld/COFF/COFFLinkerContext.cpp b/lld/COFF/COFFLinkerContext.cpp
index 39da96a9ecf17..8edea803773e9 100644
--- a/lld/COFF/COFFLinkerContext.cpp
+++ b/lld/COFF/COFFLinkerContext.cpp
@@ -25,17 +25,17 @@ COFFLinkerContext::COFFLinkerContext()
outputCommitTimer("Commit Output File", rootTimer),
totalMapTimer("MAP Emission (Cumulative)", rootTimer),
symbolGatherTimer("Gather Symbols", totalMapTimer),
- symbolStringsTimer("Build Symbol strings", totalMapTimer),
+ symbolStringsTimer("Build Symbol Strings", totalMapTimer),
writeTimer("Write to File", totalMapTimer),
totalPdbLinkTimer("PDB Emission (Cumulative)", rootTimer),
addObjectsTimer("Add Objects", totalPdbLinkTimer),
- symbolMergingTimer("Symbol Merging", addObjectsTimer),
typeMergingTimer("Type Merging", addObjectsTimer),
- tpiStreamLayoutTimer("TPI Stream Layout", totalPdbLinkTimer),
- publicsLayoutTimer("Publics Stream Layout", totalPdbLinkTimer),
- diskCommitTimer("Commit to Disk", totalPdbLinkTimer),
loadGHashTimer("Global Type Hashing", addObjectsTimer),
- mergeGHashTimer("GHash Type Merging", addObjectsTimer) {}
+ mergeGHashTimer("GHash Type Merging", addObjectsTimer),
+ symbolMergingTimer("Symbol Merging", addObjectsTimer),
+ publicsLayoutTimer("Publics Stream Layout", totalPdbLinkTimer),
+ tpiStreamLayoutTimer("TPI Stream Layout", totalPdbLinkTimer),
+ diskCommitTimer("Commit to Disk", totalPdbLinkTimer) {}
COFFLinkerContext::~COFFLinkerContext() { clearGHashes(); }
diff --git a/lld/COFF/COFFLinkerContext.h b/lld/COFF/COFFLinkerContext.h
index 594c9fde89a2d..a1890d1df0a5a 100644
--- a/lld/COFF/COFFLinkerContext.h
+++ b/lld/COFF/COFFLinkerContext.h
@@ -73,13 +73,13 @@ class COFFLinkerContext {
// PDB timers.
Timer totalPdbLinkTimer;
Timer addObjectsTimer;
- Timer symbolMergingTimer;
Timer typeMergingTimer;
- Timer tpiStreamLayoutTimer;
- Timer publicsLayoutTimer;
- Timer diskCommitTimer;
Timer loadGHashTimer;
Timer mergeGHashTimer;
+ Timer symbolMergingTimer;
+ Timer publicsLayoutTimer;
+ Timer tpiStreamLayoutTimer;
+ Timer diskCommitTimer;
};
} // namespace coff
diff --git a/lld/test/COFF/timers.ll b/lld/test/COFF/timers.ll
new file mode 100644
index 0000000000000..741a0e536b25d
--- /dev/null
+++ b/lld/test/COFF/timers.ll
@@ -0,0 +1,62 @@
+; REQUIRES: x86
+; RUN: llvm-as %s -o %t.obj
+
+; Test
diff erent configurations of lld to get all possible timer outputs.
+; RUN: lld-link %t.obj -time -entry:main -debug:noghash 2>&1 | \
+; RUN: FileCheck %s --check-prefix=CHECK1
+; RUN: lld-link %t.obj -time -entry:main -debug 2>&1 | \
+; RUN: FileCheck %s --check-prefix=CHECK2
+; RUN: lld-link %t.obj -time -entry:main -map 2>&1 | \
+; RUN: FileCheck %s --check-prefix=CHECK3
+
+; CHECK1: Input File Reading:
+; CHECK1: LTO:
+; CHECK1: Code Layout:
+; CHECK1: Commit Output File:
+; CHECK1: PDB Emission (Cumulative):
+; CHECK1: Add Objects:
+; CHECK1: Type Merging:
+; CHECK1: Symbol Merging:
+; CHECK1: Publics Stream Layout:
+; CHECK1: TPI Stream Layout:
+; CHECK1: Commit to Disk:
+
+; CHECK2: Input File Reading:
+; CHECK2: LTO:
+; CHECK2: Code Layout:
+; CHECK2: Commit Output File:
+; CHECK2: PDB Emission (Cumulative):
+; CHECK2: Add Objects:
+; CHECK2: Global Type Hashing:
+; CHECK2: GHash Type Merging:
+; CHECK2: Symbol Merging:
+; CHECK2: Publics Stream Layout:
+; CHECK2: TPI Stream Layout:
+; CHECK2: Commit to Disk:
+
+; CHECK3: Input File Reading:
+; CHECK3: LTO:
+; CHECK3: GC:
+; CHECK3: ICF:
+; CHECK3: Code Layout:
+; CHECK3: Commit Output File:
+; CHECK3: MAP Emission (Cumulative):
+; CHECK3: Gather Symbols:
+; CHECK3: Build Symbol Strings:
+; CHECK3: Write to File:
+
+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-pc-windows-msvc19.11.0"
+
+define dso_local i32 @main() {
+entry:
+ ret i32 0
+}
+
+!llvm.dbg.cu = !{!0}
+!llvm.module.flags = !{!2, !3}
+
+!0 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus_14, file: !1, producer: "clang version 14.0.0", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug, splitDebugInlining: false, nameTableKind: None)
+!1 = !DIFile(filename: "t.cpp", directory: "", checksumkind: CSK_MD5, checksum: "495fd79f78a98304e065540d576057d9")
+!2 = !{i32 2, !"CodeView", i32 1}
+!3 = !{i32 2, !"Debug Info Version", i32 3}
More information about the llvm-commits
mailing list