diff --git a/llvm/tools/bugpoint/BugDriver.h b/llvm/tools/bugpoint/BugDriver.h --- a/llvm/tools/bugpoint/BugDriver.h +++ b/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 &Funcs); +/// PrintFunctionAttributeList - prints out list of problematic function attributes +/// +void PrintFunctionAttributeList(const std::vector &Attrs); + /// PrintGlobalVariableList - prints out list of problematic global variables /// void PrintGlobalVariableList(const std::vector &GVs); diff --git a/llvm/tools/bugpoint/BugDriver.cpp b/llvm/tools/bugpoint/BugDriver.cpp --- a/llvm/tools/bugpoint/BugDriver.cpp +++ b/llvm/tools/bugpoint/BugDriver.cpp @@ -248,6 +248,17 @@ outs().flush(); } +void llvm::PrintFunctionAttributeList(const std::vector &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 &GVs) { unsigned NumPrint = GVs.size(); if (NumPrint > 10) diff --git a/llvm/tools/bugpoint/CrashDebugger.cpp b/llvm/tools/bugpoint/CrashDebugger.cpp --- a/llvm/tools/bugpoint/CrashDebugger.cpp +++ b/llvm/tools/bugpoint/CrashDebugger.cpp @@ -352,6 +352,12 @@ std::unique_ptr 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());