Author: Arthur Eubanks Date: 2021-09-30T11:36:30-07:00 New Revision: 76902079e42958118f01b4550d68a9b54c9e8e7e
URL: https://github.com/llvm/llvm-project/commit/76902079e42958118f01b4550d68a9b54c9e8e7e DIFF: https://github.com/llvm/llvm-project/commit/76902079e42958118f01b4550d68a9b54c9e8e7e.diff LOG: [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 Added: Modified: clang/lib/Frontend/CompilerInvocation.cpp clang/test/Frontend/optimization-remark.c Removed: ################################################################################ diff --git a/clang/lib/Frontend/CompilerInvocation.cpp b/clang/lib/Frontend/CompilerInvocation.cpp index 30a80d38bf205..e9eed36f36a96 100644 --- a/clang/lib/Frontend/CompilerInvocation.cpp +++ b/clang/lib/Frontend/CompilerInvocation.cpp @@ -1201,6 +1201,8 @@ ParseOptimizationRemark(DiagnosticsEngine &Diags, ArgList &Args, Result.Kind = CodeGenOptions::RK_Disabled; else if (Value == "no-everything") Result.Kind = CodeGenOptions::RK_DisabledEverything; + else + continue; if (Result.Kind == CodeGenOptions::RK_Disabled || Result.Kind == CodeGenOptions::RK_DisabledEverything) { diff --git a/clang/test/Frontend/optimization-remark.c b/clang/test/Frontend/optimization-remark.c index d4cab0bdec0cb..950980e397787 100644 --- a/clang/test/Frontend/optimization-remark.c +++ b/clang/test/Frontend/optimization-remark.c @@ -16,6 +16,7 @@ // RUN: %clang_cc1 %s -Rpass=inline -Rno-pass -emit-llvm -o - 2>&1 | FileCheck %s --check-prefix=CHECK-NO-REMARKS // RUN: %clang_cc1 %s -Rpass=inline -Rno-everything -emit-llvm -o - 2>&1 | FileCheck %s --check-prefix=CHECK-NO-REMARKS // 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 +// 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 // // The inliner for the new PM does not seem to be enabled at O0, but we still // get the same remarks with at least O1. _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits