Skip to content

Commit 6e6bcdd

Browse files
committed
[AnnotationRemarks] Support generating annotation remarks with -O0.
This matches the legacy pass manager behavior. If remarks are not enabled the pass is effectively a no-op. (cherry-picked from 770a50b)
1 parent b139057 commit 6e6bcdd

File tree

3 files changed

+5
-1
lines changed

3 files changed

+5
-1
lines changed

llvm/include/llvm/Transforms/Scalar/AnnotationRemarks.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ class Function;
2222

2323
struct AnnotationRemarksPass : public PassInfoMixin<AnnotationRemarksPass> {
2424
PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM);
25+
static bool isRequired() { return true; }
2526
};
2627
} // namespace llvm
2728

llvm/lib/Passes/PassBuilderPipelines.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1704,6 +1704,8 @@ ModulePassManager PassBuilder::buildO0DefaultPipeline(OptimizationLevel Level,
17041704
if (LTOPreLink)
17051705
addRequiredLTOPreLinkPasses(MPM);
17061706

1707+
MPM.addPass(createModuleToFunctionPassAdaptor(AnnotationRemarksPass()));
1708+
17071709
return MPM;
17081710
}
17091711

llvm/test/Other/new-pm-O0-defaults.ll

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,9 @@
5858
; CHECK-LTO-NEXT: Running analysis: InnerAnalysisManagerProxy
5959
; CHECK-LTO-NEXT: Running pass: LowerTypeTestsPass
6060
; CHECK-LTO-NEXT: Running pass: LowerTypeTestsPass
61+
; CHECK-CORO-NEXT: Running pass: AnnotationRemarksPass
6162
; CHECK-LTO-NEXT: Running pass: AnnotationRemarksPass
62-
; CHECK-LTO-NEXT: Running analysis: TargetLibraryAnalysis
63+
; CHECK-LTO-NEXT: Running analysis: TargetLibraryAnalysis
6364
; CHECK-NEXT: Running pass: PrintModulePass
6465

6566
; Make sure we get the IR back out without changes when we print the module.

0 commit comments

Comments
 (0)