[PATCH] D66832: [Bugpoint][CrashDebugger] Add --same-error to skip non-relevant CodeGenCrash
Jinsong Ji via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Aug 27 14:54:19 PDT 2019
jsji updated this revision to Diff 217503.
jsji added a comment.
Fix typos in testcase.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D66832/new/
https://reviews.llvm.org/D66832
Files:
llvm/test/BugPoint/crash-sameerror.ll
llvm/tools/bugpoint/CrashDebugger.cpp
llvm/tools/bugpoint/ToolRunner.cpp
Index: llvm/tools/bugpoint/ToolRunner.cpp
===================================================================
--- llvm/tools/bugpoint/ToolRunner.cpp
+++ llvm/tools/bugpoint/ToolRunner.cpp
@@ -109,7 +109,7 @@
OS << "\nError running tool:\n ";
for (StringRef Arg : Args)
OS << " " << Arg.str();
- OS << "\n";
+ OS << "\nError Message:\n";
// Rerun the compiler, capturing any error messages to print them.
SmallString<128> ErrorFilename;
Index: llvm/tools/bugpoint/CrashDebugger.cpp
===================================================================
--- llvm/tools/bugpoint/CrashDebugger.cpp
+++ llvm/tools/bugpoint/CrashDebugger.cpp
@@ -63,6 +63,10 @@
cl::opt<bool> VerboseErrors("verbose-errors",
cl::desc("Print the output of crashing program"),
cl::init(false));
+cl::opt<bool> SameError("same-error",
+ cl::desc("Focus on 1st crash error, treat other new crash as success"),
+ cl::init(false));
+
}
namespace llvm {
@@ -1294,11 +1298,27 @@
static bool TestForCodeGenCrash(const BugDriver &BD, Module *M) {
if (Error E = BD.compileProgram(*M)) {
- if (VerboseErrors)
- errs() << toString(std::move(E)) << "\n";
- else {
- consumeError(std::move(E));
- errs() << "<crash>\n";
+ bool SameCrash = true;
+ handleAllErrors(std::move(E), [&](const ErrorInfoBase &EIB) {
+ static std::string CrashMsgs = "";
+ if (SameError) {
+ StringRef str(EIB.message());
+ auto Msgs = str.split("Error Message:\n");
+ if (CrashMsgs.empty())
+ CrashMsgs = Msgs.second;
+ else {
+ SameCrash = CrashMsgs.compare(Msgs.second.str()) == 0;
+ }
+ }
+ if (VerboseErrors)
+ errs() << EIB.message() << "\n";
+ else {
+ errs() << "<crash>\n";
+ }
+ });
+ if (SameError) {
+ // Only retrun true when we are getting same crash
+ return SameCrash;
}
return true; // Tool is still crashing.
}
Index: llvm/test/BugPoint/crash-sameerror.ll
===================================================================
--- /dev/null
+++ llvm/test/BugPoint/crash-sameerror.ll
@@ -0,0 +1,18 @@
+; Test that bugpoint can stick to same error (ignore non-relevant errors)
+;
+; RUN: bugpoint -llc-safe %s -output-prefix %t -silence-passes -same-error > /dev/null
+; REQUIRES: powerpc-registered-target
+target triple = "powerpc64le-unknown-linux-gnu"
+
+define dso_local void @test1(i32 signext %a) local_unnamed_addr #0 {
+entry:
+; This should cause codegen error, the argument should be a constant.
+ tail call void @llvm.ppc.altivec.dss(i32 %a) #1
+ ret void
+}
+declare void @llvm.ppc.altivec.dss(i32) #1
+
+; This should trigger bugpoint limitation when reducing attributes
+; verify failed: Attribute 'optnone' requires 'noinline'!
+attributes #0 = { optnone noinline nounwind}
+attributes #1 = { nounwind }
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D66832.217503.patch
Type: text/x-patch
Size: 2966 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190827/fad03eed/attachment.bin>
More information about the llvm-commits
mailing list