[llvm] r280273 - [TargetPassConfig] Add a hook to tell whether GlobalISel should warm on fallback.

Quentin Colombet via llvm-commits llvm-commits at lists.llvm.org
Wed Aug 31 11:43:04 PDT 2016


Author: qcolombet
Date: Wed Aug 31 13:43:04 2016
New Revision: 280273

URL: http://llvm.org/viewvc/llvm-project?rev=280273&view=rev
Log:
[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.

Modified:
    llvm/trunk/include/llvm/CodeGen/TargetPassConfig.h
    llvm/trunk/lib/CodeGen/LLVMTargetMachine.cpp
    llvm/trunk/lib/CodeGen/TargetPassConfig.cpp
    llvm/trunk/test/CodeGen/AArch64/GlobalISel/arm64-fallback.ll

Modified: llvm/trunk/include/llvm/CodeGen/TargetPassConfig.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/TargetPassConfig.h?rev=280273&r1=280272&r2=280273&view=diff
==============================================================================
--- llvm/trunk/include/llvm/CodeGen/TargetPassConfig.h (original)
+++ llvm/trunk/include/llvm/CodeGen/TargetPassConfig.h Wed Aug 31 13:43:04 2016
@@ -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);

Modified: llvm/trunk/lib/CodeGen/LLVMTargetMachine.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/LLVMTargetMachine.cpp?rev=280273&r1=280272&r2=280273&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/LLVMTargetMachine.cpp (original)
+++ llvm/trunk/lib/CodeGen/LLVMTargetMachine.cpp Wed Aug 31 13:43:04 2016
@@ -169,7 +169,8 @@ addPassesToGenerateCode(LLVMTargetMachin
       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.

Modified: llvm/trunk/lib/CodeGen/TargetPassConfig.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/TargetPassConfig.cpp?rev=280273&r1=280272&r2=280273&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/TargetPassConfig.cpp (original)
+++ llvm/trunk/lib/CodeGen/TargetPassConfig.cpp Wed Aug 31 13:43:04 2016
@@ -98,11 +98,13 @@ PrintMachineInstrs("print-machineinstrs"
                    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;
 }

Modified: llvm/trunk/test/CodeGen/AArch64/GlobalISel/arm64-fallback.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/AArch64/GlobalISel/arm64-fallback.ll?rev=280273&r1=280272&r2=280273&view=diff
==============================================================================
--- llvm/trunk/test/CodeGen/AArch64/GlobalISel/arm64-fallback.ll (original)
+++ llvm/trunk/test/CodeGen/AArch64/GlobalISel/arm64-fallback.ll Wed Aug 31 13:43:04 2016
@@ -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




More information about the llvm-commits mailing list