[llvm] 7902d6c - [Remarks][ThinLTO] Use the correct file extension based on the format
Francis Visoiu Mistrih via llvm-commits
llvm-commits at lists.llvm.org
Mon Dec 2 13:05:49 PST 2019
Author: Francis Visoiu Mistrih
Date: 2019-12-02T13:04:43-08:00
New Revision: 7902d6cc803065eae4d434642a8b4afd940a216b
URL: https://github.com/llvm/llvm-project/commit/7902d6cc803065eae4d434642a8b4afd940a216b
DIFF: https://github.com/llvm/llvm-project/commit/7902d6cc803065eae4d434642a8b4afd940a216b.diff
LOG: [Remarks][ThinLTO] Use the correct file extension based on the format
Since we now have multiple formats, the ThinLTO remark files should also
respect that.
Added:
Modified:
llvm/lib/LTO/LTO.cpp
llvm/test/ThinLTO/X86/diagnostic-handler-remarks.ll
Removed:
################################################################################
diff --git a/llvm/lib/LTO/LTO.cpp b/llvm/lib/LTO/LTO.cpp
index ebe22c37c707..0d48090e4268 100644
--- a/llvm/lib/LTO/LTO.cpp
+++ b/llvm/lib/LTO/LTO.cpp
@@ -1381,8 +1381,12 @@ lto::setupOptimizationRemarks(LLVMContext &Context, StringRef RemarksFilename,
StringRef RemarksPasses, StringRef RemarksFormat,
bool RemarksWithHotness, int Count) {
std::string Filename = RemarksFilename;
+ // For ThinLTO, file.opt.<format> becomes
+ // file.opt.<format>.thin.<num>.<format>.
if (!Filename.empty() && Count != -1)
- Filename += ".thin." + llvm::utostr(Count) + ".yaml";
+ Filename =
+ (Twine(Filename) + ".thin." + llvm::utostr(Count) + "." + RemarksFormat)
+ .str();
auto ResultOrErr = llvm::setupOptimizationRemarks(
Context, Filename, RemarksPasses, RemarksFormat, RemarksWithHotness);
diff --git a/llvm/test/ThinLTO/X86/diagnostic-handler-remarks.ll b/llvm/test/ThinLTO/X86/diagnostic-handler-remarks.ll
index b83e93b7a29d..a996b8586eef 100644
--- a/llvm/test/ThinLTO/X86/diagnostic-handler-remarks.ll
+++ b/llvm/test/ThinLTO/X86/diagnostic-handler-remarks.ll
@@ -51,6 +51,19 @@
; YAML2-NEXT: - String: ')'
; YAML2-NEXT: ...
+; The file extension depends on the format of the remarks
+; RUN: rm -f %t.bitstream.thin.0.bitstream %t.bitstream.thin.1.bitstream
+; RUN: llvm-lto -thinlto-action=run \
+; RUN: -lto-pass-remarks-output=%t.bitstream \
+; RUN: -lto-pass-remarks-filter=inline \
+; RUN: -lto-pass-remarks-format=bitstream \
+; RUN: -exported-symbol _func2 \
+; RUN: -exported-symbol _main %t1.bc %t2.bc 2>&1 | \
+; RUN: FileCheck %s -allow-empty
+; RUN: llvm-bcanalyzer %t.bitstream.thin.0.bitstream
+; RUN: llvm-bcanalyzer %t.bitstream.thin.1.bitstream
+; CHECK-NOT: remark:
+; CHECK-NOT: llvm-lto:
target datalayout = "e-m:o-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-apple-macosx10.11.0"
More information about the llvm-commits
mailing list