[PATCH] D43113: [bugpoint] Don't stop reducing when verification fails, keep trying
Vedant Kumar via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Feb 8 21:40:47 PST 2018
vsk updated this revision to Diff 133563.
vsk added a comment.
- Fixed up a test.
https://reviews.llvm.org/D43113
Files:
test/BugPoint/unsymbolized.ll
tools/bugpoint/BugDriver.h
tools/bugpoint/CrashDebugger.cpp
tools/bugpoint/ExtractFunction.cpp
Index: tools/bugpoint/ExtractFunction.cpp
===================================================================
--- tools/bugpoint/ExtractFunction.cpp
+++ tools/bugpoint/ExtractFunction.cpp
@@ -121,7 +121,7 @@
std::unique_ptr<Module> New = runPassesOn(Clone.get(), Passes);
if (!New) {
errs() << "Instruction removal failed. Sorry. :( Please report a bug!\n";
- exit(1);
+ return nullptr;
}
return New;
}
Index: tools/bugpoint/CrashDebugger.cpp
===================================================================
--- tools/bugpoint/CrashDebugger.cpp
+++ tools/bugpoint/CrashDebugger.cpp
@@ -451,7 +451,7 @@
std::unique_ptr<Module> New = BD.runPassesOn(M.get(), Passes);
if (!New) {
errs() << "verify failed!\n";
- exit(1);
+ return false;
}
M = std::move(New);
@@ -558,7 +558,7 @@
std::unique_ptr<Module> New = BD.runPassesOn(M.get(), Passes);
if (!New) {
errs() << "verify failed!\n";
- exit(1);
+ return false;
}
M = std::move(New);
@@ -650,7 +650,7 @@
std::unique_ptr<Module> New = BD.runPassesOn(M.get(), Passes);
if (!New) {
errs() << "verify failed!\n";
- exit(1);
+ return false;
}
M = std::move(New);
@@ -1010,6 +1010,8 @@
outs() << "Checking instruction: " << *I;
std::unique_ptr<Module> M =
BD.deleteInstructionFromProgram(&*I, Simplification);
+ if (!M) // We couldn't delete this instruction. Keep trying.
+ continue;
// Find out if the pass still crashes on this pass...
if (TestFn(BD, M.get())) {
Index: tools/bugpoint/BugDriver.h
===================================================================
--- tools/bugpoint/BugDriver.h
+++ tools/bugpoint/BugDriver.h
@@ -200,7 +200,8 @@
/// This method clones the current Program and deletes the specified
/// instruction from the cloned module. It then runs a series of cleanup
/// passes (ADCE and SimplifyCFG) to eliminate any code which depends on the
- /// value. The modified module is then returned.
+ /// value. The modified module is then returned. If deletion causes module
+ /// verification to fail, nullptr is returned.
///
std::unique_ptr<Module> deleteInstructionFromProgram(const Instruction *I,
unsigned Simp);
Index: test/BugPoint/unsymbolized.ll
===================================================================
--- test/BugPoint/unsymbolized.ll
+++ test/BugPoint/unsymbolized.ll
@@ -2,7 +2,7 @@
; RUN: echo "import sys" > %t.py
; RUN: echo "print('args = ' + str(sys.argv))" >> %t.py
; RUN: echo "exit(1)" >> %t.py
-; RUN: not bugpoint -load %llvmshlibdir/BugpointPasses%shlibext %s -output-prefix %t -bugpoint-crashcalls -opt-command="%python" -opt-args %t.py | FileCheck %s
+; RUN: bugpoint -load %llvmshlibdir/BugpointPasses%shlibext %s -output-prefix %t -bugpoint-crashcalls -opt-command="%python" -opt-args %t.py | FileCheck %s
; RUN: not --crash opt -load %llvmshlibdir/BugpointPasses%shlibext %s -bugpoint-crashcalls -disable-symbolication 2>&1 | FileCheck --check-prefix=CRASH %s
; Test that bugpoint disables symbolication on the opt tool to reduce runtime overhead when opt crashes
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D43113.133563.patch
Type: text/x-patch
Size: 3262 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180209/0db11d81/attachment.bin>
More information about the llvm-commits
mailing list