]> granicus.if.org Git - clang/commitdiff
Revert "[Remarks] Add -foptimization-record-passes to filter remark emission"
authorFrancis Visoiu Mistrih <francisvm@yahoo.com>
Tue, 12 Mar 2019 20:54:18 +0000 (20:54 +0000)
committerFrancis Visoiu Mistrih <francisvm@yahoo.com>
Tue, 12 Mar 2019 20:54:18 +0000 (20:54 +0000)
This reverts commit 20fff32b7d1f1a1bd417b22aa9f26ededd97a3e5.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@355976 91177308-0d34-0410-b5e6-96231b3b80d8

12 files changed:
include/clang/Basic/CodeGenOptions.h
include/clang/Driver/CC1Options.td
include/clang/Driver/Options.td
lib/CodeGen/BackendUtil.cpp
lib/CodeGen/CodeGenAction.cpp
lib/Driver/ToolChains/Clang.cpp
lib/Driver/ToolChains/Darwin.cpp
lib/Frontend/CompilerInvocation.cpp
test/CodeGen/opt-record-MIR.c
test/CodeGen/opt-record.c
test/Driver/darwin-ld.c
test/Driver/opt-record.c

index 200706fda7caceb70da0269b7a59d68275232cfa..fc284f8c67746de96fcb8eae6beba43fd74ec157 100644 (file)
@@ -238,10 +238,6 @@ public:
   /// records.
   std::string OptRecordFile;
 
-  /// The regex that filters the passes that should be saved to the optimization
-  /// records.
-  std::string OptRecordPasses;
-
   /// Regular expression to select optimizations for which we should enable
   /// optimization remarks. Transformation passes whose name matches this
   /// expression (and support this feature), will emit a diagnostic
index 2825a927797ae793920c5ca3d9cddd21a105882c..f4f8fae39e30e702a767957bc0f1372ff651bee0 100644 (file)
@@ -603,8 +603,6 @@ def arcmt_migrate : Flag<["-"], "arcmt-migrate">,
 
 def opt_record_file : Separate<["-"], "opt-record-file">,
   HelpText<"File name to use for YAML optimization record output">;
-def opt_record_passes : Separate<["-"], "opt-record-passes">,
-  HelpText<"Only record remark information for passes whose names match the given regular expression">;
 
 def print_stats : Flag<["-"], "print-stats">,
   HelpText<"Print performance metrics and statistics">;
index 0f05effe278e036cba46f233f598a065ab47b863..81e4ce75b02f51aa7157cc51cbb18f5112984ea2 100644 (file)
@@ -1715,10 +1715,6 @@ def fno_save_optimization_record : Flag<["-"], "fno-save-optimization-record">,
 def foptimization_record_file_EQ : Joined<["-"], "foptimization-record-file=">,
   Group<f_Group>,
   HelpText<"Specify the file name of any generated YAML optimization record">;
-def foptimization_record_passes_EQ : Joined<["-"], "foptimization-record-passes=">,
-  Group<f_Group>,
-  HelpText<"Only include passes which match a specified regular expression in the generated optimization record (by default, include all passes)">;
-
 
 def ftest_coverage : Flag<["-"], "ftest-coverage">, Group<f_Group>;
 def fvectorize : Flag<["-"], "fvectorize">, Group<f_Group>,
index 34705ad8ff80f6ff260ebe08e1011a45d461ed55..30a3dc830f6e43736f1236ee239eded89c737e9b 100644 (file)
@@ -1340,7 +1340,6 @@ static void runThinLTOBackend(ModuleSummaryIndex *CombinedIndex, Module *M,
   Conf.DebugPassManager = CGOpts.DebugPassManager;
   Conf.RemarksWithHotness = CGOpts.DiagnosticsWithHotness;
   Conf.RemarksFilename = CGOpts.OptRecordFile;
-  Conf.RemarksPasses = CGOpts.OptRecordPasses;
   Conf.DwoPath = CGOpts.SplitDwarfFile;
   switch (Action) {
   case Backend_EmitNothing:
index cab3a6bc32bf3f62290bbb60dd3861b170329858..f59adcd3fb922b9ed0f7dab97dd28a316bc93db9 100644 (file)
@@ -19,7 +19,6 @@
 #include "clang/Basic/TargetInfo.h"
 #include "clang/CodeGen/BackendUtil.h"
 #include "clang/CodeGen/ModuleBuilder.h"
-#include "clang/Driver/DriverDiagnostic.h"
 #include "clang/Frontend/CompilerInstance.h"
 #include "clang/Frontend/FrontendDiagnostic.h"
 #include "clang/Lex/Preprocessor.h"
@@ -281,12 +280,6 @@ namespace clang {
         Ctx.setRemarkStreamer(llvm::make_unique<RemarkStreamer>(
             CodeGenOpts.OptRecordFile, OptRecordFile->os()));
 
-        if (!CodeGenOpts.OptRecordPasses.empty())
-          if (Error E = Ctx.getRemarkStreamer()->setFilter(
-                  CodeGenOpts.OptRecordPasses))
-            Diags.Report(diag::err_drv_optimization_remark_pattern)
-                << toString(std::move(E)) << CodeGenOpts.OptRecordPasses;
-
         if (CodeGenOpts.getProfileUse() != CodeGenOptions::ProfileNone)
           Ctx.setDiagnosticsHotnessRequested(true);
       }
index bf9ab9dd1074e3fb5597ede084d2b29492dca354..3bc7412911b61e74c1b2ba60ee71ee7cbe85fa9a 100644 (file)
@@ -5032,11 +5032,8 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA,
                    options::OPT_fno_apple_pragma_pack, false))
     CmdArgs.push_back("-fapple-pragma-pack");
 
-  // Remarks can be enabled with any of the `-f.*optimization-record.*` flags.
   if (Args.hasFlag(options::OPT_fsave_optimization_record,
                    options::OPT_foptimization_record_file_EQ,
-                   options::OPT_fno_save_optimization_record, false) ||
-      Args.hasFlag(options::OPT_foptimization_record_passes_EQ,
                    options::OPT_fno_save_optimization_record, false)) {
     CmdArgs.push_back("-opt-record-file");
 
@@ -5071,11 +5068,6 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA,
       llvm::sys::path::replace_extension(F, "opt.yaml");
       CmdArgs.push_back(Args.MakeArgString(F));
     }
-    if (const Arg *A =
-            Args.getLastArg(options::OPT_foptimization_record_passes_EQ)) {
-      CmdArgs.push_back("-opt-record-passes");
-      CmdArgs.push_back(A->getValue());
-    }
   }
 
   bool RewriteImports = Args.hasFlag(options::OPT_frewrite_imports,
index f91ab1946f51645d081db300f3fa3b78f66dac44..ea93fadcdc22a102669732f5292f149e5ae9f05d 100644 (file)
@@ -483,14 +483,6 @@ void darwin::Linker::ConstructJob(Compilation &C, const JobAction &JA,
         CmdArgs.push_back(Args.MakeArgString(Opt));
       }
     }
-
-    if (const Arg *A =
-            Args.getLastArg(options::OPT_foptimization_record_passes_EQ)) {
-      CmdArgs.push_back("-mllvm");
-      std::string Passes =
-          std::string("-lto-pass-remarks-filter=") + A->getValue();
-      CmdArgs.push_back(Args.MakeArgString(Passes));
-    }
   }
 
   // Propagate the -moutline flag to the linker in LTO.
index b5872b961cce7fdd959f6ddf2b6be1a997bfdac1..1cd1cb1ff47ee45517340c5dacb05b6d3ccbf587 100644 (file)
@@ -1218,11 +1218,6 @@ static bool ParseCodeGenArgs(CodeGenOptions &Opts, ArgList &Args, InputKind IK,
   if (!Opts.OptRecordFile.empty())
     NeedLocTracking = true;
 
-  if (Arg *A = Args.getLastArg(OPT_opt_record_passes)) {
-    Opts.OptRecordPasses = A->getValue();
-    NeedLocTracking = true;
-  }
-
   if (Arg *A = Args.getLastArg(OPT_Rpass_EQ)) {
     Opts.OptimizationRemarkPattern =
         GenerateOptimizationRemarkRegex(Diags, Args, A);
index f9b4e7458059543c4130f50454db4e2c6565e268..37239281e9e9fa8ec9a6a4599c17e01ba72b8aa3 100644 (file)
@@ -3,8 +3,6 @@
 // RUN: %clang_cc1 -triple arm64-apple-ios -S -o /dev/null %s -O2 -dwarf-column-info 2>&1 | FileCheck -allow-empty -check-prefix=NO_REMARK %s
 // RUN: %clang_cc1 -triple arm64-apple-ios -S -o /dev/null %s -O2 -dwarf-column-info -opt-record-file %t.yaml
 // RUN: cat %t.yaml | FileCheck -check-prefix=YAML %s
-// RUN: %clang_cc1 -triple arm64-apple-ios -S -o /dev/null %s -O2 -dwarf-column-info -opt-record-file %t.yaml -opt-record-passes asm-printer
-// RUN: cat %t.yaml | FileCheck -check-prefix=PASSES %s
 
 void bar(float);
 
@@ -17,15 +15,15 @@ void foo(float *p, int i) {
   }
 }
 
-// REMARK: opt-record-MIR.c:{{[1-9][0-9]*}}:{{[1-9][0-9]*}}: remark: {{.}} spills {{.}} reloads generated in loop
+// REMARK: opt-record-MIR.c:10:11: remark: {{.}} spills {{.}} reloads generated in loop
 // NO_REMARK-NOT: remark:
 
 // YAML: --- !Missed
 // YAML: Pass:            regalloc
 // YAML: Name:            LoopSpillReload
 // YAML: DebugLoc:        { File: {{[^,]+}},
-// YAML:                    Line: {{[1-9][0-9]*}}
-// YAML:                    Column: {{[1-9][0-9]*}} }
+// YAML:                    Line: 10,
+// YAML:                    Column: 11 }
 // YAML: Function:        foo
 // YAML: Args:
 // YAML:   - NumSpills:       '{{.}}'
@@ -34,6 +32,3 @@ void foo(float *p, int i) {
 // YAML:   - String:          ' reloads '
 // YAML:   - String:          generated
 // YAML: ...
-
-// PASSES: Pass:            asm-printer
-// PASSES-NOT: regalloc
index 3f134854fe5851922363893f7d4a4b84c20f9db3..3bc3c41f7840081ec9d5a1ae440c1ba84a079814 100644 (file)
@@ -3,8 +3,6 @@
 // RUN: llvm-profdata merge %S/Inputs/opt-record.proftext -o %t.profdata
 // RUN: %clang_cc1 -O3 -triple x86_64-unknown-linux-gnu -target-cpu x86-64 -fprofile-instrument-use-path=%t.profdata %s -o %t -dwarf-column-info -opt-record-file %t.yaml -emit-obj
 // RUN: cat %t.yaml | FileCheck -check-prefix=CHECK -check-prefix=CHECK-PGO %s
-// RUN: %clang_cc1 -O3 -triple x86_64-unknown-linux-gnu -target-cpu x86-64 %s -o %t -dwarf-column-info -opt-record-file %t.yaml -opt-record-passes inline -emit-obj
-// RUN: cat %t.yaml | FileCheck -check-prefix=CHECK-PASSES %s
 // REQUIRES: x86-registered-target
 
 void bar();
@@ -25,7 +23,6 @@ void Test(int *res, int *c, int *d, int *p, int n) {
 // CHECK: DebugLoc:
 // CHECK: Function:        foo
 // CHECK-PGO: Hotness:
-// CHECK-PASSES: Pass: inline
 
 // CHECK: --- !Passed
 // CHECK: Pass:            loop-vectorize
@@ -33,4 +30,4 @@ void Test(int *res, int *c, int *d, int *p, int n) {
 // CHECK: DebugLoc:
 // CHECK: Function:        Test
 // CHECK-PGO: Hotness:
-// CHECK-PASSES-NOT: loop-vectorize
+
index b120bbe8a34a422eb46f1431dfde8a4c68436ac8..181d4e324cc50647c5e29f41e9e467009131a2e6 100644 (file)
 // RUN: FileCheck -check-prefix=PASS_REMARKS_WITH_HOTNESS_THRESHOLD %s < %t.log
 // PASS_REMARKS_WITH_HOTNESS_THRESHOLD: "-mllvm" "-lto-pass-remarks-output" "-mllvm" "foo/bar.out.opt.yaml" "-mllvm" "-lto-pass-remarks-with-hotness" "-mllvm" "-lto-pass-remarks-hotness-threshold=100"
 
-// RUN: %clang -target x86_64-apple-darwin12 %t.o -fsave-optimization-record -foptimization-record-passes=inline -### -o foo/bar.out 2> %t.log
-// RUN: FileCheck -check-prefix=PASS_REMARKS_WITH_PASSES %s < %t.log
-// PASS_REMARKS_WITH_PASSES: "-mllvm" "-lto-pass-remarks-output" "-mllvm" "foo/bar.out.opt.yaml" "-mllvm" "-lto-pass-remarks-filter=inline"
-
 // RUN: %clang -target x86_64-apple-ios6.0 -miphoneos-version-min=6.0 -fprofile-instr-generate -### %t.o 2> %t.log
 // RUN: FileCheck -check-prefix=LINK_PROFILE_FIRST %s < %t.log
 // RUN: %clang -target x86_64-apple-darwin12 -fprofile-instr-generate -### %t.o 2> %t.log
index 44ad4a2a6b328aa587fcf597aac0438ec9fc98ab..7b4ec48632e208845854bb013b68cd1882e0db36 100644 (file)
 // RUN: %clang -### -S -o FOO -foptimization-record-file=BAR.txt %s 2>&1 | FileCheck %s -check-prefix=CHECK-EQ
 // RUN: %clang -### -S -o FOO -foptimization-record-file=BAR.txt -fno-save-optimization-record %s 2>&1 | FileCheck %s --check-prefix=CHECK-FOPT-DISABLE
 
-// RUN: %clang -### -S -o FOO -fsave-optimization-record -foptimization-record-passes=inline %s 2>&1 | FileCheck %s -check-prefix=CHECK-EQ-PASSES
-// RUN: %clang -### -S -o FOO -foptimization-record-passes=inline %s 2>&1 | FileCheck %s -check-prefix=CHECK-EQ-PASSES
-// RUN: %clang -### -S -o FOO -foptimization-record-passes=inline -fno-save-optimization-record %s 2>&1 | FileCheck %s --check-prefix=CHECK-FOPT-DISABLE-PASSES
-//
 // CHECK: "-cc1"
 // CHECK: "-opt-record-file" "FOO.opt.yaml"
 
@@ -27,8 +23,3 @@
 // CHECK-EQ: "-opt-record-file" "BAR.txt"
 
 // CHECK-FOPT-DISABLE-NOT: "-fno-save-optimization-record"
-
-// CHECK-EQ-PASSES: "-cc1"
-// CHECK-EQ-PASSES: "-opt-record-passes" "inline"
-
-// CHECK-FOPT-DISABLE-PASSES-NOT: "-fno-save-optimization-record"