1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2025-01-31 20:51:52 +01:00

[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.
This commit is contained in:
Francis Visoiu Mistrih 2019-12-02 13:02:48 -08:00
parent 1de5b61d60
commit a0d8c69089
2 changed files with 18 additions and 1 deletions

View File

@ -1381,8 +1381,12 @@ lto::setupOptimizationRemarks(LLVMContext &Context, StringRef RemarksFilename,
StringRef RemarksPasses, StringRef RemarksFormat, StringRef RemarksPasses, StringRef RemarksFormat,
bool RemarksWithHotness, int Count) { bool RemarksWithHotness, int Count) {
std::string Filename = RemarksFilename; std::string Filename = RemarksFilename;
// For ThinLTO, file.opt.<format> becomes
// file.opt.<format>.thin.<num>.<format>.
if (!Filename.empty() && Count != -1) if (!Filename.empty() && Count != -1)
Filename += ".thin." + llvm::utostr(Count) + ".yaml"; Filename =
(Twine(Filename) + ".thin." + llvm::utostr(Count) + "." + RemarksFormat)
.str();
auto ResultOrErr = llvm::setupOptimizationRemarks( auto ResultOrErr = llvm::setupOptimizationRemarks(
Context, Filename, RemarksPasses, RemarksFormat, RemarksWithHotness); Context, Filename, RemarksPasses, RemarksFormat, RemarksWithHotness);

View File

@ -51,6 +51,19 @@
; YAML2-NEXT: - String: ')' ; YAML2-NEXT: - String: ')'
; YAML2-NEXT: ... ; 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 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" target triple = "x86_64-apple-macosx10.11.0"