[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:11:51 PDT 2022


loladiro updated this revision to Diff 419017.
loladiro added a comment.

Fix docstring typo


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D122695/new/

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);
 
+/// PrintFunctionAttributeList - 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.419017.patch
Type: text/x-patch
Size: 2195 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220330/251cac46/attachment.bin>


More information about the llvm-commits mailing list