[PATCH] D36906: Keep Optimization Remark Yaml in NewPM
Sam Elliott via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Sat Aug 19 01:34:05 PDT 2017
lenary updated this revision to Diff 111807.
lenary added a comment.
Better Patch for opt remark file issue, undoing changes to new PM interface, and renaming variables as requested.
https://reviews.llvm.org/D36906
Files:
test/Transforms/Util/libcalls-opt-remarks.ll
tools/opt/opt.cpp
Index: tools/opt/opt.cpp
===================================================================
--- tools/opt/opt.cpp
+++ tools/opt/opt.cpp
@@ -433,14 +433,14 @@
std::unique_ptr<tool_output_file> YamlFile;
if (RemarksFilename != "") {
std::error_code EC;
- YamlFile = llvm::make_unique<tool_output_file>(RemarksFilename, EC,
- sys::fs::F_None);
+ OptRemarkFile = llvm::make_unique<tool_output_file>(RemarksFilename, EC,
+ sys::fs::F_None);
if (EC) {
errs() << EC.message() << '\n';
return 1;
}
Context.setDiagnosticsOutputFile(
- llvm::make_unique<yaml::Output>(YamlFile->os()));
+ llvm::make_unique<yaml::Output>(OptRemarkFile->os()));
}
// Load the input module...
@@ -539,12 +539,17 @@
// The user has asked to use the new pass manager and provided a pipeline
// string. Hand off the rest of the functionality to the new code for that
// layer.
- return runPassPipeline(argv[0], *M, TM.get(), Out.get(), ThinLinkOut.get(),
- PassPipeline, OK, VK, PreserveAssemblyUseListOrder,
- PreserveBitcodeUseListOrder, EmitSummaryIndex,
- EmitModuleHash)
- ? 0
- : 1;
+ if (runPassPipeline(argv[0], *M, TM.get(), Out.get(), ThinLinkOut.get(),
+ PassPipeline, OK, VK, PreserveAssemblyUseListOrder,
+ PreserveBitcodeUseListOrder, EmitSummaryIndex,
+ EmitModuleHash)) {
+
+ if (OptRemarkFile)
+ OptRemarkFile->keep();
+
+ return 0;
+ } else
+ return 1;
}
// Create a PassManager to hold and optimize the collection of passes we are
@@ -767,8 +772,8 @@
"the compile-twice option\n";
Out->os() << BOS->str();
Out->keep();
- if (YamlFile)
- YamlFile->keep();
+ if (OptRemarkFile)
+ OptRemarkFile->keep();
return 1;
}
Out->os() << BOS->str();
@@ -778,8 +783,8 @@
if (!NoOutput || PrintBreakpoints)
Out->keep();
- if (YamlFile)
- YamlFile->keep();
+ if (OptRemarkFile)
+ OptRemarkFile->keep();
if (ThinLinkOut)
ThinLinkOut->keep();
Index: test/Transforms/Util/libcalls-opt-remarks.ll
===================================================================
--- test/Transforms/Util/libcalls-opt-remarks.ll
+++ test/Transforms/Util/libcalls-opt-remarks.ll
@@ -1,8 +1,9 @@
-; RUN: opt < %s -instcombine -o /dev/null -pass-remarks-output=%t -S -pass-remarks=instcombine \
-; RUN: 2>&1 | FileCheck %s
+; RUN: opt < %s -instcombine -o /dev/null -pass-remarks-output=%t -S \
+; RUN: -pass-remarks=instcombine 2>&1 | FileCheck %s
+; RUN: cat %t | FileCheck -check-prefix=YAML %s
+; RUN: opt < %s -passes='require<opt-remark-emit>,instcombine' -o /dev/null \
+; RUN: -pass-remarks-output=%t -S -pass-remarks=instcombine 2>&1 | FileCheck %s
; RUN: cat %t | FileCheck -check-prefix=YAML %s
-; RUN: opt < %s -passes='require<opt-remark-emit>,instcombine' -o /dev/null -S -pass-remarks=instcombine \
-; RUN: 2>&1 | FileCheck %s
; CHECK: remark: libcalls-opt-remarks.c:10:10: folded strlen(select) to select of constants{{$}}
; CHECK-NOT: remark:
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D36906.111807.patch
Type: text/x-patch
Size: 3341 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170819/cba0e1c3/attachment.bin>
More information about the llvm-commits
mailing list