Skip to content

Commit 7690207

Browse files
committed
[clang] Don't modify OptRemark if the argument is not relevant
A followup to D110201. For example, we'd set OptimizationRemarkMissed's Regex to '.*' when encountering -Rpass. Normally this doesn't actually affect remarks we emit because in clang::ProcessWarningOptions() we'll separately look at all -R arguments and turn on/off corresponding diagnostic groups. However, this is reproducible with -round-trip-args. Reviewed By: JamesNagurne Differential Revision: https://reviews.llvm.org/D110673
1 parent 691814f commit 7690207

File tree

2 files changed

+3
-0
lines changed

2 files changed

+3
-0
lines changed

clang/lib/Frontend/CompilerInvocation.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1201,6 +1201,8 @@ ParseOptimizationRemark(DiagnosticsEngine &Diags, ArgList &Args,
12011201
Result.Kind = CodeGenOptions::RK_Disabled;
12021202
else if (Value == "no-everything")
12031203
Result.Kind = CodeGenOptions::RK_DisabledEverything;
1204+
else
1205+
continue;
12041206

12051207
if (Result.Kind == CodeGenOptions::RK_Disabled ||
12061208
Result.Kind == CodeGenOptions::RK_DisabledEverything) {

clang/test/Frontend/optimization-remark.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
// RUN: %clang_cc1 %s -Rpass=inline -Rno-pass -emit-llvm -o - 2>&1 | FileCheck %s --check-prefix=CHECK-NO-REMARKS
1717
// RUN: %clang_cc1 %s -Rpass=inline -Rno-everything -emit-llvm -o - 2>&1 | FileCheck %s --check-prefix=CHECK-NO-REMARKS
1818
// RUN: %clang_cc1 %s -Rpass=inline -fno-experimental-new-pass-manager -Rno-everything -Reverything -emit-llvm -o - 2>&1 | FileCheck %s --check-prefix=CHECK-REMARKS
19+
// RUN: %clang_cc1 %s -Rpass -Rno-pass -round-trip-args -fexperimental-new-pass-manager -mllvm -mandatory-inlining-first=false -O1 -emit-llvm -o - 2>&1 | FileCheck %s --check-prefix=CHECK-NO-REMARKS
1920
//
2021
// The inliner for the new PM does not seem to be enabled at O0, but we still
2122
// get the same remarks with at least O1.

0 commit comments

Comments
 (0)