From fb2d34229941a32666bec8ca96ba3beb703ed188 Mon Sep 17 00:00:00 2001 From: Bob Haarman Date: Thu, 8 Mar 2018 01:13:10 +0000 Subject: [PATCH] Revert "[LTO] Support filtering by hotness threshold" This reverts commit 1f3bd185c53beb6aa68446974b7e80837abd6ef0 (r326107) because it fails ThinLTO/X86/diagnostic-handler-remarks-with-hotness.ll. llvm-svn: 326975 --- llvm/include/llvm/LTO/Config.h | 4 ---- llvm/include/llvm/LTO/LTO.h | 4 +--- llvm/lib/LTO/LTO.cpp | 10 ++++---- llvm/lib/LTO/LTOBackend.cpp | 3 +-- llvm/lib/LTO/LTOCodeGenerator.cpp | 9 +------- llvm/lib/LTO/ThinLTOCodeGenerator.cpp | 4 +--- .../X86/diagnostic-handler-remarks-with-hotness.ll | 15 ------------ .../X86/diagnostic-handler-remarks-with-hotness.ll | 27 +++------------------- 8 files changed, 11 insertions(+), 65 deletions(-) diff --git a/llvm/include/llvm/LTO/Config.h b/llvm/include/llvm/LTO/Config.h index 00b9491..4bd981c 100644 --- a/llvm/include/llvm/LTO/Config.h +++ b/llvm/include/llvm/LTO/Config.h @@ -79,10 +79,6 @@ struct Config { /// Whether to emit optimization remarks with hotness informations. bool RemarksWithHotness = false; - /// The minimum hotness value a diagnostic needs in order to be included in - /// optimization diagnostics. - unsigned RemarksHotnessThreshold = 0; - /// Whether to emit the pass manager debuggging informations. bool DebugPassManager = false; diff --git a/llvm/include/llvm/LTO/LTO.h b/llvm/include/llvm/LTO/LTO.h index b0e5abc..f376d6f 100644 --- a/llvm/include/llvm/LTO/LTO.h +++ b/llvm/include/llvm/LTO/LTO.h @@ -73,9 +73,7 @@ std::string getThinLTOOutputFile(const std::string &Path, /// Setup optimization remarks. Expected> setupOptimizationRemarks(LLVMContext &Context, StringRef LTORemarksFilename, - bool LTOPassRemarksWithHotness, - unsigned LTOPassRemarksHotnessThreshold, - int Count = -1); + bool LTOPassRemarksWithHotness, int Count = -1); class LTO; struct SymbolResolution; diff --git a/llvm/lib/LTO/LTO.cpp b/llvm/lib/LTO/LTO.cpp index 58b1cd0..e9ac314 100644 --- a/llvm/lib/LTO/LTO.cpp +++ b/llvm/lib/LTO/LTO.cpp @@ -1202,10 +1202,10 @@ Error LTO::runThinLTO(AddStreamFn AddStream, NativeObjectCache Cache) { return BackendProc->wait(); } -Expected> lto::setupOptimizationRemarks( - LLVMContext &Context, StringRef LTORemarksFilename, - bool LTOPassRemarksWithHotness, unsigned LTOPassRemarksHotnessThreshold, - int Count) { +Expected> +lto::setupOptimizationRemarks(LLVMContext &Context, + StringRef LTORemarksFilename, + bool LTOPassRemarksWithHotness, int Count) { if (LTORemarksFilename.empty()) return nullptr; @@ -1222,8 +1222,6 @@ Expected> lto::setupOptimizationRemarks( llvm::make_unique(DiagnosticFile->os())); if (LTOPassRemarksWithHotness) Context.setDiagnosticsHotnessRequested(true); - if (LTOPassRemarksHotnessThreshold) - Context.setDiagnosticsHotnessThreshold(LTOPassRemarksHotnessThreshold); DiagnosticFile->keep(); return std::move(DiagnosticFile); } diff --git a/llvm/lib/LTO/LTOBackend.cpp b/llvm/lib/LTO/LTOBackend.cpp index 4607444..074a398 100644 --- a/llvm/lib/LTO/LTOBackend.cpp +++ b/llvm/lib/LTO/LTOBackend.cpp @@ -376,8 +376,7 @@ Error lto::backend(Config &C, AddStreamFn AddStream, // Setup optimization remarks. auto DiagFileOrErr = lto::setupOptimizationRemarks( - Mod->getContext(), C.RemarksFilename, C.RemarksWithHotness, - C.RemarksHotnessThreshold); + Mod->getContext(), C.RemarksFilename, C.RemarksWithHotness); if (!DiagFileOrErr) return DiagFileOrErr.takeError(); auto DiagnosticOutputFile = std::move(*DiagFileOrErr); diff --git a/llvm/lib/LTO/LTOCodeGenerator.cpp b/llvm/lib/LTO/LTOCodeGenerator.cpp index 939d12a..ffe9af7 100644 --- a/llvm/lib/LTO/LTOCodeGenerator.cpp +++ b/llvm/lib/LTO/LTOCodeGenerator.cpp @@ -89,12 +89,6 @@ cl::opt LTOPassRemarksWithHotness( "lto-pass-remarks-with-hotness", cl::desc("With PGO, include profile count in optimization remarks"), cl::Hidden); - -cl::opt LTOPassRemarksHotnessThreshold( - "lto-pass-remarks-hotness-threshold", - cl::desc("Minimum profile count required for an optimization remark to be " - "output"), - cl::Hidden); } LTOCodeGenerator::LTOCodeGenerator(LLVMContext &Context) @@ -511,8 +505,7 @@ bool LTOCodeGenerator::optimize(bool DisableVerify, bool DisableInline, return false; auto DiagFileOrErr = lto::setupOptimizationRemarks( - Context, LTORemarksFilename, LTOPassRemarksWithHotness, - LTOPassRemarksHotnessThreshold); + Context, LTORemarksFilename, LTOPassRemarksWithHotness); if (!DiagFileOrErr) { errs() << "Error: " << toString(DiagFileOrErr.takeError()) << "\n"; report_fatal_error("Can't get an output file for the remarks"); diff --git a/llvm/lib/LTO/ThinLTOCodeGenerator.cpp b/llvm/lib/LTO/ThinLTOCodeGenerator.cpp index b3e30b6..92cc245 100644 --- a/llvm/lib/LTO/ThinLTOCodeGenerator.cpp +++ b/llvm/lib/LTO/ThinLTOCodeGenerator.cpp @@ -63,7 +63,6 @@ namespace llvm { extern cl::opt LTODiscardValueNames; extern cl::opt LTORemarksFilename; extern cl::opt LTOPassRemarksWithHotness; -extern cl::opt LTOPassRemarksHotnessThreshold; } namespace { @@ -999,8 +998,7 @@ void ThinLTOCodeGenerator::run() { Context.setDiscardValueNames(LTODiscardValueNames); Context.enableDebugTypeODRUniquing(); auto DiagFileOrErr = lto::setupOptimizationRemarks( - Context, LTORemarksFilename, LTOPassRemarksWithHotness, - LTOPassRemarksHotnessThreshold, count); + Context, LTORemarksFilename, LTOPassRemarksWithHotness, count); if (!DiagFileOrErr) { errs() << "Error: " << toString(DiagFileOrErr.takeError()) << "\n"; report_fatal_error("ThinLTO: Can't get an output file for the " diff --git a/llvm/test/LTO/X86/diagnostic-handler-remarks-with-hotness.ll b/llvm/test/LTO/X86/diagnostic-handler-remarks-with-hotness.ll index a792fd1..8111699 100644 --- a/llvm/test/LTO/X86/diagnostic-handler-remarks-with-hotness.ll +++ b/llvm/test/LTO/X86/diagnostic-handler-remarks-with-hotness.ll @@ -8,18 +8,6 @@ ; RUN: -exported-symbol _main -o %t.o %t.bc ; RUN: cat %t.yaml | FileCheck -check-prefix=YAML %s -; RUN: llvm-lto -lto-pass-remarks-output=%t.yaml \ -; RUN: -lto-pass-remarks-with-hotness \ -; RUN: -lto-pass-remarks-hotness-threshold=400 \ -; RUN: -exported-symbol _main -o %t.o %t.bc -; RUN: cat %t.yaml | FileCheck -allow-empty -check-prefix=YAML_TH_HIGH %s - -; RUN: llvm-lto -lto-pass-remarks-output=%t.yaml \ -; RUN: -lto-pass-remarks-with-hotness \ -; RUN: -lto-pass-remarks-hotness-threshold=200 \ -; RUN: -exported-symbol _main -o %t.o %t.bc -; RUN: cat %t.yaml | FileCheck -allow-empty -check-prefix=YAML %s - ; YAML: --- !Passed ; YAML-NEXT: Pass: inline ; YAML-NEXT: Name: Inlined @@ -36,9 +24,6 @@ ; YAML-NEXT: - String: ')' ; YAML-NEXT: ... -; YAML_TH_HIGH-NOT: Name: Inlined - - target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-apple-darwin" diff --git a/llvm/test/ThinLTO/X86/diagnostic-handler-remarks-with-hotness.ll b/llvm/test/ThinLTO/X86/diagnostic-handler-remarks-with-hotness.ll index 429acb5..0f0e26e 100644 --- a/llvm/test/ThinLTO/X86/diagnostic-handler-remarks-with-hotness.ll +++ b/llvm/test/ThinLTO/X86/diagnostic-handler-remarks-with-hotness.ll @@ -5,7 +5,7 @@ ; with -lto-pass-remarks-with-hotness. ; RUN: llvm-lto -thinlto-action=run \ -; RUN: -lto-pass-remarks-output=%t-no-th.yaml \ +; RUN: -lto-pass-remarks-output=%t.yaml \ ; RUN: -lto-pass-remarks-with-hotness \ ; RUN: -exported-symbol _func2 \ ; RUN: -exported-symbol _main %t1.bc %t2.bc 2>&1 | \ @@ -13,25 +13,9 @@ ; CHECK-NOT: remark: ; CHECK-NOT: llvm-lto: -; RUN: llvm-lto -thinlto-action=run \ -; RUN: -lto-pass-remarks-output=%t-low-th.yaml \ -; RUN: -lto-pass-remarks-with-hotness \ -; RUN: -lto-pass-remarks-hotness-threshold=20 \ -; RUN: -exported-symbol _func2 \ -; RUN: -exported-symbol _main %t1.bc %t2.bc 2>&1 | \ - -; RUN: llvm-lto -thinlto-action=run \ -; RUN: -lto-pass-remarks-output=%t-high-th.yaml \ -; RUN: -lto-pass-remarks-with-hotness \ -; RUN: -lto-pass-remarks-hotness-threshold=100 \ -; RUN: -exported-symbol _func2 \ -; RUN: -exported-symbol _main %t1.bc %t2.bc 2>&1 | \ - ; Verify that bar is imported and inlined into foo -; RUN: cat %t-no-th.yaml.thin.0.yaml | FileCheck %s -check-prefix=YAML1 -; RUN: cat %t-low-th.yaml.thin.0.yaml | FileCheck %s -check-prefix=YAML1 -; RUN: cat %t-high-th.yaml.thin.0.yaml | FileCheck %s -allow-empty -check-prefix=YAML1_TH_HIGH +; RUN: cat %t.yaml.thin.0.yaml | FileCheck %s -check-prefix=YAML1 ; YAML1: --- !Passed ; YAML1-NEXT: Pass: inline ; YAML1-NEXT: Name: Inlined @@ -48,13 +32,9 @@ ; YAML1-NEXT: - String: ')' ; YAML1-NEXT: ... -; YAML1_TH_HIGH-NOT: Name: Inlined - ; Verify that bar is imported and inlined into foo -; RUN: cat %t-no-th.yaml.thin.1.yaml | FileCheck %s -check-prefix=YAML2 -; RUN: cat %t-low-th.yaml.thin.1.yaml | FileCheck %s -allow-empty -check-prefix=YAML2_TH_HIGH -; RUN: cat %t-high-th.yaml.thin.1.yaml | FileCheck %s -allow-empty -check-prefix=YAML2_TH_HIGH +; RUN: cat %t.yaml.thin.1.yaml | FileCheck %s -check-prefix=YAML2 ; YAML2: --- !Passed ; YAML2-NEXT: Pass: inline ; YAML2-NEXT: Name: Inlined @@ -70,7 +50,6 @@ ; YAML2-NEXT: - String: ')' ; YAML2-NEXT: ... -; YAML2_TH_HIGH-NOT: Name: Inlined target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-apple-macosx10.11.0" -- 2.7.4