From 374796d67853db94589da4aec48443e28e1a1590 Mon Sep 17 00:00:00 2001 From: Quentin Colombet Date: Sat, 27 Aug 2016 00:18:31 +0000 Subject: [GlobalISel] Add a fallback path to SDISel. When global-isel fails on a MachineFunction MF, MF will be cleaned up and given to SDISel. Thanks to this fallback, we can already perform correctness test even if we support only a small portion of the functions in a test. llvm-svn: 279891 --- llvm/lib/CodeGen/LLVMTargetMachine.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'llvm/lib/CodeGen/LLVMTargetMachine.cpp') diff --git a/llvm/lib/CodeGen/LLVMTargetMachine.cpp b/llvm/lib/CodeGen/LLVMTargetMachine.cpp index 844e1ffe681..e11eb014111 100644 --- a/llvm/lib/CodeGen/LLVMTargetMachine.cpp +++ b/llvm/lib/CodeGen/LLVMTargetMachine.cpp @@ -168,6 +168,15 @@ addPassesToGenerateCode(LLVMTargetMachine *TM, PassManagerBase &PM, if (PassConfig->addGlobalInstructionSelect()) return nullptr; + // Pass to reset the MachineFunction if the ISel failed. + PM.add(createResetMachineFunctionPass()); + + // Provide a fallback path when we do not want to abort on + // not-yet-supported input. + if (LLVM_UNLIKELY(!PassConfig->isGlobalISelAbortEnabled()) && + PassConfig->addInstSelector()) + return nullptr; + } else if (PassConfig->addInstSelector()) return nullptr; -- cgit v1.2.3