summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorQuentin Colombet <qcolombet@apple.com>2016-08-31 18:43:04 +0000
committerQuentin Colombet <qcolombet@apple.com>2016-08-31 18:43:04 +0000
commit1c06a73a7c300105e9f685d4388e0f2d6c0021a1 (patch)
treef88004ff5777f3c2ad6f8246c22ae064769a2d99
parent612cd1fdd64cc7593b38115abd0e1bfb6f552b9d (diff)
downloadbcm5719-llvm-1c06a73a7c300105e9f685d4388e0f2d6c0021a1.tar.gz
bcm5719-llvm-1c06a73a7c300105e9f685d4388e0f2d6c0021a1.zip
[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
-rw-r--r--llvm/include/llvm/CodeGen/TargetPassConfig.h5
-rw-r--r--llvm/lib/CodeGen/LLVMTargetMachine.cpp3
-rw-r--r--llvm/lib/CodeGen/TargetPassConfig.cpp14
-rw-r--r--llvm/test/CodeGen/AArch64/GlobalISel/arm64-fallback.ll5
4 files changed, 21 insertions, 6 deletions
diff --git a/llvm/include/llvm/CodeGen/TargetPassConfig.h b/llvm/include/llvm/CodeGen/TargetPassConfig.h
index 6f94ae455ee..706afd58ba6 100644
--- a/llvm/include/llvm/CodeGen/TargetPassConfig.h
+++ b/llvm/include/llvm/CodeGen/TargetPassConfig.h
@@ -286,6 +286,11 @@ public:
/// erroring out.
virtual bool isGlobalISelAbortEnabled() const;
+ /// Check whether or not a diagnostic should be emitted when GlobalISel
+ /// uses the fallback path. In other words, it will emit a diagnostic
+ /// when GlobalISel failed and isGlobalISelAbortEnabled is false.
+ virtual bool reportDiagnosticWhenGlobalISelFallback() const;
+
protected:
// Helper to verify the analysis is really immutable.
void setOpt(bool &Opt, bool Val);
diff --git a/llvm/lib/CodeGen/LLVMTargetMachine.cpp b/llvm/lib/CodeGen/LLVMTargetMachine.cpp
index e11eb014111..c094ab80052 100644
--- a/llvm/lib/CodeGen/LLVMTargetMachine.cpp
+++ b/llvm/lib/CodeGen/LLVMTargetMachine.cpp
@@ -169,7 +169,8 @@ addPassesToGenerateCode(LLVMTargetMachine *TM, PassManagerBase &PM,
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 88b94f51928..1244681592b 100644
--- a/llvm/lib/CodeGen/TargetPassConfig.cpp
+++ b/llvm/lib/CodeGen/TargetPassConfig.cpp
@@ -98,11 +98,13 @@ PrintMachineInstrs("print-machineinstrs", cl::ValueOptional,
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 @@ void TargetPassConfig::addBlockPlacement() {
/// GlobalISel Configuration
//===---------------------------------------------------------------------===//
bool TargetPassConfig::isGlobalISelAbortEnabled() const {
- return EnableGlobalISelAbort;
+ return EnableGlobalISelAbort == 1;
+}
+
+bool TargetPassConfig::reportDiagnosticWhenGlobalISelFallback() const {
+ return EnableGlobalISelAbort == 2;
}
diff --git a/llvm/test/CodeGen/AArch64/GlobalISel/arm64-fallback.ll b/llvm/test/CodeGen/AArch64/GlobalISel/arm64-fallback.ll
index 1dcf63acbf4..590f34f2452 100644
--- a/llvm/test/CodeGen/AArch64/GlobalISel/arm64-fallback.ll
+++ b/llvm/test/CodeGen/AArch64/GlobalISel/arm64-fallback.ll
@@ -1,5 +1,6 @@
; RUN: not llc -O0 -global-isel -verify-machineinstrs %s -o - 2>&1 | FileCheck %s --check-prefix=ERROR
-; RUN: llc -O0 -global-isel -global-isel-abort=false -verify-machineinstrs %s -o - 2>&1 | FileCheck %s --check-prefix=FALLBACK
+; RUN: llc -O0 -global-isel -global-isel-abort=0 -verify-machineinstrs %s -o - 2>&1 | FileCheck %s --check-prefix=FALLBACK
+; RUN: llc -O0 -global-isel -global-isel-abort=2 -verify-machineinstrs %s -o - 2>&1 | FileCheck %s --check-prefix=FALLBACK_WITH_REPORT
; This file checks that the fallback path to selection dag works.
; The test is fragile in the sense that it must be updated to expose
; something that fails with global-isel.
@@ -12,6 +13,8 @@ target triple = "aarch64-apple-ios"
; ERROR: Unable to lower arguments
; FALLBACK: ldr q0,
; FALLBACK-NEXT: bl ___fixunstfti
+;
+; FALLBACK_WITH_REPORT-DAG: bl ___fixunstfti
define i128 @ABIi128(i128 %arg1) {
%farg1 = bitcast i128 %arg1 to fp128
%res = fptoui fp128 %farg1 to i128
OpenPOWER on IntegriCloud