Skip to content

Commit

Permalink
Set error message to report
Browse files Browse the repository at this point in the history
Avoids recommending filing bugs with LLVM project for IREE project
tooling.
  • Loading branch information
jpienaar committed Dec 19, 2022
1 parent 37f09e8 commit 45fe69e
Show file tree
Hide file tree
Showing 10 changed files with 41 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@
#include "mlir/Tools/mlir-opt/MlirOptMain.h"

int ireeOptRunMain(int argc, char **argv) {
llvm::setBugReportMsg(
"Please report issues to https://github.com/iree-org/iree/issues and "
"include the crash backtrace.\n");
llvm::InitLLVM y(argc, argv);

mlir::DialectRegistry registry;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,9 @@ static Flavor parseFlavor(std::vector<const char *> &v) {
}

int ireeCompilerRunLldMain(int argc, char **argv) {
llvm::setBugReportMsg(
"Please report issues to https://github.com/iree-org/iree/issues and "
"include the crash backtrace.\n");
InitLLVM x(argc, argv);
sys::Process::UseANSIEscapeCodes(true);
bool exitEarly = true;
Expand Down
3 changes: 3 additions & 0 deletions compiler/src/iree/compiler/Tools/iree_compile_lib.cc
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,9 @@ enum class CompileMode {
} // namespace mlir

int mlir::iree_compiler::runIreecMain(int argc, char **argv) {
llvm::setBugReportMsg(
"Please report issues to https://github.com/iree-org/iree/issues and "
"include the crash backtrace.\n");
llvm::InitLLVM y(argc, argv);
static llvm::cl::OptionCategory mainOptions("IREE Main Options");
ireeCompilerGlobalInitialize(/*initializeCommandLine=*/true);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,9 @@ static OwningOpRef<mlir::ModuleOp> importSavedModelV1(

int main(int argc, char **argv) {
tensorflow::InitMlir y(&argc, &argv);
llvm::setBugReportMsg(
"Please report issues to https://github.com/iree-org/iree/issues and "
"include the crash backtrace.\n");

static cl::opt<std::string> inputPath(
cl::Positional, cl::desc("<saved model directory>"), cl::Required);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,9 @@ enum class OutputFormat {
};

int main(int argc, char **argv) {
llvm::setBugReportMsg(
"Please report issues to https://github.com/iree-org/iree/issues and "
"include the crash backtrace.\n");
llvm::InitLLVM y(argc, argv);

static cl::opt<std::string> inputPath(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,9 @@ LogicalResult ReadHloTextFormatFromStream(std::istream *in,
} // namespace

int main(int argc, char **argv) {
llvm::setBugReportMsg(
"Please report issues to https://github.com/iree-org/iree/issues and "
"include the crash backtrace.\n");
llvm::InitLLVM y(argc, argv);

static cl::opt<std::string> inputPath(
Expand Down
11 changes: 11 additions & 0 deletions integrations/tensorflow/iree_tf_compiler/iree-opt-tflite-main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,17 @@
#include "tensorflow/compiler/mlir/tosa/transforms/passes.h"

int main(int argc, char **argv) {
static cl::opt<std::string> inputPath(
cl::Positional, cl::desc("<XLA Protocol Buffer Path>"), cl::Required);
static cl::opt<std::string> outputFilename("o", cl::desc("Output filename"),
cl::value_desc("filename"),
cl::init("-"));
static llvm::cl::opt<std::string> saveTempMhloInput(
"save-temp-mhlo-input",
llvm::cl::desc("Save the MHLO pipeline input IR to this file"),
llvm::setBugReportMsg(
"Please report issues to https://github.com/iree-org/iree/issues and "
"include the crash backtrace.\n");
llvm::InitLLVM y(argc, argv);

mlir::DialectRegistry registry;
Expand Down
3 changes: 3 additions & 0 deletions integrations/tensorflow/iree_tf_compiler/iree-tf-opt-main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@
#include "tensorflow/compiler/mlir/tosa/transforms/passes.h"

int main(int argc, char **argv) {
llvm::setBugReportMsg(
"Please report issues to https://github.com/iree-org/iree/issues and "
"include the crash backtrace.\n");
llvm::InitLLVM y(argc, argv);

mlir::DialectRegistry registry;
Expand Down
7 changes: 6 additions & 1 deletion tools/iree-opt-main.cc
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,9 @@

#include "iree/compiler/API2/ToolEntryPoints.h"

int main(int argc, char **argv) { return ireeOptRunMain(argc, argv); }
int main(int argc, char **argv) {
llvm::setBugReportMsg(
"Please report issues to https://github.com/iree-org/iree/issues and "
"include the crash backtrace.\n");
return ireeOptRunMain(argc, argv);
}
3 changes: 3 additions & 0 deletions tools/iree-run-mlir-main.cc
Original file line number Diff line number Diff line change
Expand Up @@ -573,6 +573,9 @@ extern "C" int main(int argc_llvm, char** argv_llvm) {

// On Windows InitLLVM re-queries the command line from Windows directly and
// totally messes up the array.
llvm::setBugReportMsg(
"Please report issues to https://github.com/iree-org/iree/issues and "
"include the crash backtrace.\n");
llvm::InitLLVM init_llvm(argc_llvm, argv_llvm);
llvm::cl::ParseCommandLineOptions(argc_llvm, argv_llvm);

Expand Down

0 comments on commit 45fe69e

Please sign in to comment.