[PATCH] D71967: [opt] Fix run-twice crash and detection problem
Kókai Péter via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Sun Dec 29 01:47:59 PST 2019
Kokan updated this revision to Diff 235505.
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D71967/new/
https://reviews.llvm.org/D71967
Files:
llvm/tools/opt/opt.cpp
Index: llvm/tools/opt/opt.cpp
===================================================================
--- llvm/tools/opt/opt.cpp
+++ llvm/tools/opt/opt.cpp
@@ -901,8 +901,10 @@
std::unique_ptr<raw_svector_ostream> BOS;
raw_ostream *OS = nullptr;
+ const bool ShouldEmitOutput = !NoOutput && !AnalyzeOnly;
+
// Write bitcode or assembly to the output as the last step...
- if (!NoOutput && !AnalyzeOnly) {
+ if (ShouldEmitOutput || RunTwice) {
assert(Out);
OS = &Out->os();
if (RunTwice) {
@@ -950,13 +952,16 @@
"Writing the result of the second run to the specified output.\n"
"To generate the one-run comparison binary, just run without\n"
"the compile-twice option\n";
- Out->os() << BOS->str();
- Out->keep();
+ if (ShouldEmitOutput) {
+ Out->os() << BOS->str();
+ Out->keep();
+ }
if (RemarksFile)
RemarksFile->keep();
return 1;
}
- Out->os() << BOS->str();
+ if (ShouldEmitOutput)
+ Out->os() << BOS->str();
}
if (DebugifyEach && !DebugifyExport.empty())
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D71967.235505.patch
Type: text/x-patch
Size: 1108 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20191229/4ba919a6/attachment.bin>
More information about the llvm-commits
mailing list