[TargetPassConfig] Add a hook to tell whether GlobalISel should warm on fallback.
Thanks to this patch, we know have a way to easly see if GlobalISel
failed.
llvm-svn: 280273
diff --git a/llvm/lib/CodeGen/LLVMTargetMachine.cpp b/llvm/lib/CodeGen/LLVMTargetMachine.cpp
index e11eb01..c094ab8 100644
--- a/llvm/lib/CodeGen/LLVMTargetMachine.cpp
+++ b/llvm/lib/CodeGen/LLVMTargetMachine.cpp
@@ -169,7 +169,8 @@
return nullptr;
// Pass to reset the MachineFunction if the ISel failed.
- PM.add(createResetMachineFunctionPass());
+ PM.add(createResetMachineFunctionPass(
+ PassConfig->reportDiagnosticWhenGlobalISelFallback()));
// Provide a fallback path when we do not want to abort on
// not-yet-supported input.
diff --git a/llvm/lib/CodeGen/TargetPassConfig.cpp b/llvm/lib/CodeGen/TargetPassConfig.cpp
index 88b94f5..1244681 100644
--- a/llvm/lib/CodeGen/TargetPassConfig.cpp
+++ b/llvm/lib/CodeGen/TargetPassConfig.cpp
@@ -98,11 +98,13 @@
cl::desc("Print machine instrs"),
cl::value_desc("pass-name"), cl::init("option-unspecified"));
-static cl::opt<bool> EnableGlobalISelAbort(
+static cl::opt<int> EnableGlobalISelAbort(
"global-isel-abort", cl::Hidden,
cl::desc("Enable abort calls when \"global\" instruction selection "
- "fails to lower/select an instruction"),
- cl::init(true));
+ "fails to lower/select an instruction: 0 disable the abort, "
+ "1 enable the abort, and "
+ "2 disable the abort but emit a diagnostic on failure"),
+ cl::init(1));
// Temporary option to allow experimenting with MachineScheduler as a post-RA
// scheduler. Targets can "properly" enable this with
@@ -899,5 +901,9 @@
/// GlobalISel Configuration
//===---------------------------------------------------------------------===//
bool TargetPassConfig::isGlobalISelAbortEnabled() const {
- return EnableGlobalISelAbort;
+ return EnableGlobalISelAbort == 1;
+}
+
+bool TargetPassConfig::reportDiagnosticWhenGlobalISelFallback() const {
+ return EnableGlobalISelAbort == 2;
}