[PATCH] D71967: [opt] run-twice crash
Kókai Péter via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Sat Dec 28 13:07:54 PST 2019
Kokan created this revision.
Kokan added reviewers: LLVM, efriedma.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.
opt crash was reported https://bugs.llvm.org/show_bug.cgi?id=44382 , this attempt to fix both that crash and false-positive case with `-run-twice` option.
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
@@ -902,7 +902,7 @@
raw_ostream *OS = nullptr;
// Write bitcode or assembly to the output as the last step...
- if (!NoOutput && !AnalyzeOnly) {
+ if ((!NoOutput && !AnalyzeOnly) || RunTwice) {
assert(Out);
OS = &Out->os();
if (RunTwice) {
@@ -950,13 +950,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 (!NoOutput && !AnalyzeOnly) {
+ Out->os() << BOS->str();
+ Out->keep();
+ }
if (RemarksFile)
RemarksFile->keep();
return 1;
}
- Out->os() << BOS->str();
+ if (!NoOutput && !AnalyzeOnly)
+ Out->os() << BOS->str();
}
if (DebugifyEach && !DebugifyExport.empty())
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D71967.235490.patch
Type: text/x-patch
Size: 1029 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20191228/96dac116/attachment.bin>
More information about the llvm-commits
mailing list