Skip to content

Commit

Permalink
[Pipeline] Remove Annotation2Metadata pass in post-link pipelines
Browse files Browse the repository at this point in the history
The pre-link pipeline already ran the pass and it only needs to be run once.

Reviewed By: nikic

Differential Revision: https://reviews.llvm.org/D145978
  • Loading branch information
aeubanks committed Apr 13, 2023
1 parent 5fd9d80 commit 4bf9ca5
Show file tree
Hide file tree
Showing 6 changed files with 7 additions and 19 deletions.
6 changes: 0 additions & 6 deletions llvm/lib/Passes/PassBuilderPipelines.cpp
Expand Up @@ -1500,9 +1500,6 @@ ModulePassManager PassBuilder::buildThinLTODefaultPipeline(
OptimizationLevel Level, const ModuleSummaryIndex *ImportSummary) {
ModulePassManager MPM;

// Convert @llvm.global.annotations to !annotation metadata.
MPM.addPass(Annotation2MetadataPass());

if (ImportSummary) {
// These passes import type identifier resolutions for whole-program
// devirtualization and CFI. They must run early because other passes may
Expand Down Expand Up @@ -1564,9 +1561,6 @@ PassBuilder::buildLTODefaultPipeline(OptimizationLevel Level,
ModuleSummaryIndex *ExportSummary) {
ModulePassManager MPM;

// Convert @llvm.global.annotations to !annotation metadata.
MPM.addPass(Annotation2MetadataPass());

for (auto &C : FullLinkTimeOptimizationEarlyEPCallbacks)
C(MPM, Level);

Expand Down
6 changes: 2 additions & 4 deletions llvm/test/Other/new-pm-O0-defaults.ll
Expand Up @@ -41,12 +41,10 @@
; CHECK-CORO-NEXT: Running pass: CoroConditionalWrapper
; CHECK-PRE-LINK: Running pass: CanonicalizeAliasesPass
; CHECK-PRE-LINK-NEXT: Running pass: NameAnonGlobalPass
; CHECK-THINLTO: Running pass: Annotation2MetadataPass
; CHECK-THINLTO-NEXT: Running pass: LowerTypeTestsPass
; CHECK-THINLTO: Running pass: LowerTypeTestsPass
; CHECK-THINLTO-NEXT: Running pass: EliminateAvailableExternallyPass
; CHECK-THINLTO-NEXT: Running pass: GlobalDCEPass
; CHECK-LTO: Running pass: Annotation2MetadataPass
; CHECK-LTO-NEXT: Running pass: CrossDSOCFIPass on [module]
; CHECK-LTO: Running pass: CrossDSOCFIPass on [module]
; CHECK-LTO-NEXT: Running pass: WholeProgramDevirtPass
; CHECK-LTO-NEXT: Running analysis: InnerAnalysisManagerProxy
; CHECK-LTO-NEXT: Running pass: LowerTypeTestsPass
Expand Down
5 changes: 2 additions & 3 deletions llvm/test/Other/new-pm-lto-defaults.ll
Expand Up @@ -27,9 +27,8 @@
; RUN: -passes='lto<O3>' -S %s -passes-ep-peephole='no-op-function' 2>&1 \
; RUN: | FileCheck %s --check-prefixes=CHECK-O,CHECK-O3,CHECK-O23,CHECK-O23SZ,CHECK-EP-Peephole

; CHECK-O: Running pass: Annotation2Metadata
; CHECK-EP-NEXT: Running pass: NoOpModulePass
; CHECK-O-NEXT: Running pass: CrossDSOCFIPass
; CHECK-EP: Running pass: NoOpModulePass
; CHECK-O: Running pass: CrossDSOCFIPass
; CHECK-O-NEXT: Running pass: OpenMPOptPass
; CHECK-O-NEXT: Running pass: GlobalDCEPass
; CHECK-O-NEXT: Running pass: ForceFunctionAttrsPass
Expand Down
3 changes: 1 addition & 2 deletions llvm/test/Other/new-pm-thinlto-postlink-defaults.ll
Expand Up @@ -36,8 +36,7 @@
; Suppress FileCheck --allow-unused-prefixes=false diagnostics.
; CHECK-NOEXT: {{^}}

; CHECK-O: Running pass: Annotation2Metadata
; CHECK-O-NEXT: Running pass: ForceFunctionAttrsPass
; CHECK-O: Running pass: ForceFunctionAttrsPass
; CHECK-EP-PIPELINE-START-NEXT: Running pass: NoOpModulePass
; CHECK-DIS-NEXT: Running analysis: InnerAnalysisManagerProxy
; CHECK-DIS-NEXT: Running pass: AddDiscriminatorsPass
Expand Down
3 changes: 1 addition & 2 deletions llvm/test/Other/new-pm-thinlto-postlink-pgo-defaults.ll
Expand Up @@ -23,8 +23,7 @@
; Suppress FileCheck --allow-unused-prefixes=false diagnostics.
; CHECK-NOEXT: {{^}}

; CHECK-O: Running pass: Annotation2Metadata
; CHECK-O-NEXT: Running pass: ForceFunctionAttrsPass
; CHECK-O: Running pass: ForceFunctionAttrsPass
; CHECK-EP-PIPELINE-START-NEXT: Running pass: NoOpModulePass
; CHECK-O-NEXT: Running pass: PGOIndirectCallPromotion
; CHECK-O-NEXT: Running analysis: ProfileSummaryAnalysis
Expand Down
Expand Up @@ -28,8 +28,7 @@
; Suppress FileCheck --allow-unused-prefixes=false diagnostics.
; CHECK-NOEXT: {{^}}

; CHECK-O: Running pass: Annotation2Metadata
; CHECK-O-NEXT: Running pass: ForceFunctionAttrsPass
; CHECK-O: Running pass: ForceFunctionAttrsPass
; CHECK-EP-PIPELINE-START-NEXT: Running pass: NoOpModulePass
; CHECK-O-NEXT: Running pass: InferFunctionAttrsPass
; CHECK-O-NEXT: Running analysis: InnerAnalysisManagerProxy
Expand Down

0 comments on commit 4bf9ca5

Please sign in to comment.