[PATCH] D122695: [bugpoint] Print out current list of attributes in attribute reducer
Keno Fischer via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Mar 29 17:10:48 PDT 2022
loladiro created this revision.
loladiro added a reviewer: reames.
Herald added a project: All.
loladiro requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.
To make it easy to see what's going on, e.g. when this reducer
is taking forever as reported in https://github.com/llvm/llvm-project/issues/54632.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D122695
Files:
llvm/tools/bugpoint/BugDriver.cpp
llvm/tools/bugpoint/BugDriver.h
llvm/tools/bugpoint/CrashDebugger.cpp
Index: llvm/tools/bugpoint/CrashDebugger.cpp
===================================================================
--- llvm/tools/bugpoint/CrashDebugger.cpp
+++ llvm/tools/bugpoint/CrashDebugger.cpp
@@ -352,6 +352,12 @@
std::unique_ptr<Module> M = CloneModule(BD.getProgram());
Function *F = M->getFunction(FnName);
+ outs() << "Checking for crash, while reducing function attributes for function ";
+ outs() << FnName;
+ outs() << " keeping only: "
+ PrintFunctionAttributeList(Attrs);
+ outs() << ": ";
+
// Build up an AttributeList from the attributes we've been given by the
// reducer.
AttrBuilder AB(M->getContext());
Index: llvm/tools/bugpoint/BugDriver.h
===================================================================
--- llvm/tools/bugpoint/BugDriver.h
+++ llvm/tools/bugpoint/BugDriver.h
@@ -15,6 +15,7 @@
#ifndef LLVM_TOOLS_BUGPOINT_BUGDRIVER_H
#define LLVM_TOOLS_BUGPOINT_BUGDRIVER_H
+#include "llvm/IR/Attributes.h"
#include "llvm/IR/ValueMap.h"
#include "llvm/Support/Error.h"
#include "llvm/Support/FileSystem.h"
@@ -281,6 +282,10 @@
///
void PrintFunctionList(const std::vector<Function *> &Funcs);
+/// PrintFunctionList - prints out list of problematic function attributes
+///
+void PrintFunctionAttributeList(const std::vector<Attribute> &Attrs);
+
/// PrintGlobalVariableList - prints out list of problematic global variables
///
void PrintGlobalVariableList(const std::vector<GlobalVariable *> &GVs);
Index: llvm/tools/bugpoint/BugDriver.cpp
===================================================================
--- llvm/tools/bugpoint/BugDriver.cpp
+++ llvm/tools/bugpoint/BugDriver.cpp
@@ -248,6 +248,17 @@
outs().flush();
}
+void llvm::PrintFunctionAttributeList(const std::vector<Attribute> &Attrs) {
+ unsigned NumPrint = Attrs.size();
+ if (NumPrint > 10)
+ NumPrint = 10;
+ for (unsigned i = 0; i != NumPrint; ++i)
+ outs() << " " << Attrs[i].getAsString();
+ if (NumPrint < Attrs.size())
+ outs() << "... <" << Attrs.size() << " total>";
+ outs().flush();
+}
+
void llvm::PrintGlobalVariableList(const std::vector<GlobalVariable *> &GVs) {
unsigned NumPrint = GVs.size();
if (NumPrint > 10)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D122695.419016.patch
Type: text/x-patch
Size: 2186 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220330/6889d8b6/attachment.bin>
More information about the llvm-commits
mailing list