[PATCH] D46387: [LTO] Allow pass remarks with hotness to be set when emitting to stderr
Teresa Johnson via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri May 4 17:05:25 PDT 2018
This revision was automatically updated to reflect the committed changes.
Closed by commit rL331569: [LTO] Allow pass remarks with hotness to be set when emitting to stderr (authored by tejohnson, committed by ).
Repository:
rL LLVM
https://reviews.llvm.org/D46387
Files:
llvm/trunk/lib/LTO/LTO.cpp
llvm/trunk/test/LTO/Resolution/X86/diagnostic-handler-remarks-with-hotness.ll
llvm/trunk/tools/llvm-lto2/llvm-lto2.cpp
Index: llvm/trunk/test/LTO/Resolution/X86/diagnostic-handler-remarks-with-hotness.ll
===================================================================
--- llvm/trunk/test/LTO/Resolution/X86/diagnostic-handler-remarks-with-hotness.ll
+++ llvm/trunk/test/LTO/Resolution/X86/diagnostic-handler-remarks-with-hotness.ll
@@ -1,13 +1,21 @@
; RUN: llvm-as < %s >%t.bc
+; Check pass remarks emitted to YAML file
; RUN: rm -f %t.yaml
; RUN: llvm-lto2 run -pass-remarks-output=%t.yaml \
; RUN: -pass-remarks-with-hotness \
; RUN: -r %t.bc,tinkywinky,p \
; RUN: -r %t.bc,patatino,px \
; RUN: -r %t.bc,main,px -o %t.o %t.bc
; RUN: cat %t.yaml | FileCheck %s -check-prefix=YAML
+; Check pass remarks emitted to stderr
+; RUN: llvm-lto2 run -pass-remarks=inline \
+; RUN: -pass-remarks-with-hotness \
+; RUN: -r %t.bc,tinkywinky,p \
+; RUN: -r %t.bc,patatino,px \
+; RUN: -r %t.bc,main,px -o %t.o %t.bc 2>&1 | FileCheck %s
+
; YAML: --- !Passed
; YAML-NEXT: Pass: inline
; YAML-NEXT: Name: Inlined
@@ -24,6 +32,8 @@
; YAML-NEXT: - String: ')'
; YAML-NEXT: ...
+; CHECK: tinkywinky inlined into main with cost=-15000 (threshold=337) (hotness: 300)
+
target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-scei-ps4"
Index: llvm/trunk/lib/LTO/LTO.cpp
===================================================================
--- llvm/trunk/lib/LTO/LTO.cpp
+++ llvm/trunk/lib/LTO/LTO.cpp
@@ -1226,6 +1226,8 @@
lto::setupOptimizationRemarks(LLVMContext &Context,
StringRef LTORemarksFilename,
bool LTOPassRemarksWithHotness, int Count) {
+ if (LTOPassRemarksWithHotness)
+ Context.setDiagnosticsHotnessRequested(true);
if (LTORemarksFilename.empty())
return nullptr;
@@ -1240,8 +1242,6 @@
return errorCodeToError(EC);
Context.setDiagnosticsOutputFile(
llvm::make_unique<yaml::Output>(DiagnosticFile->os()));
- if (LTOPassRemarksWithHotness)
- Context.setDiagnosticsHotnessRequested(true);
DiagnosticFile->keep();
return std::move(DiagnosticFile);
}
Index: llvm/trunk/tools/llvm-lto2/llvm-lto2.cpp
===================================================================
--- llvm/trunk/tools/llvm-lto2/llvm-lto2.cpp
+++ llvm/trunk/tools/llvm-lto2/llvm-lto2.cpp
@@ -192,7 +192,8 @@
DiagnosticPrinterRawOStream DP(errs());
DI.print(DP);
errs() << '\n';
- exit(1);
+ if (DI.getSeverity() == DS_Error)
+ exit(1);
};
Conf.CPU = MCPU;
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D46387.145329.patch
Type: text/x-patch
Size: 2601 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180505/62c74f09/attachment.bin>
More information about the llvm-commits
mailing list