From df613198c0d6d208f57f02abc882b36b686fef64 Mon Sep 17 00:00:00 2001 From: Tom Stellard Date: Fri, 18 Nov 2016 14:14:35 +0000 Subject: [PATCH] GlobalISel: Fix unconditional fallback with global isel abort is disabled Reviewers: t.p.northover, ab, qcolombet Subscribers: mehdi_amini, vkalintiris, wdng, dberris, llvm-commits, rovka Differential Revision: https://reviews.llvm.org/D26765 llvm-svn: 287344 --- llvm/lib/CodeGen/GlobalISel/InstructionSelect.cpp | 2 +- llvm/test/CodeGen/AArch64/GlobalISel/gisel-abort.ll | 8 ++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) create mode 100644 llvm/test/CodeGen/AArch64/GlobalISel/gisel-abort.ll diff --git a/llvm/lib/CodeGen/GlobalISel/InstructionSelect.cpp b/llvm/lib/CodeGen/GlobalISel/InstructionSelect.cpp index 72e4a23b..1d205cd 100644 --- a/llvm/lib/CodeGen/GlobalISel/InstructionSelect.cpp +++ b/llvm/lib/CodeGen/GlobalISel/InstructionSelect.cpp @@ -164,7 +164,7 @@ bool InstructionSelect::runOnMachineFunction(MachineFunction &MF) { MRI.getVRegToType().clear(); - if (!TPC.isGlobalISelAbortEnabled() && (Failed || MF.size() == NumBlocks)) { + if (!TPC.isGlobalISelAbortEnabled() && (Failed || MF.size() != NumBlocks)) { MF.getProperties().set(MachineFunctionProperties::Property::FailedISel); return false; } diff --git a/llvm/test/CodeGen/AArch64/GlobalISel/gisel-abort.ll b/llvm/test/CodeGen/AArch64/GlobalISel/gisel-abort.ll new file mode 100644 index 0000000..76eafdd --- /dev/null +++ b/llvm/test/CodeGen/AArch64/GlobalISel/gisel-abort.ll @@ -0,0 +1,8 @@ +; RUN: llc -march aarch64 -global-isel -global-isel-abort=2 -verify-machineinstrs %s -o - 2>&1 | FileCheck %s + +; CHECK-NOT: fallback +; CHECK: empty +define void @empty() { + ret void +} + -- 2.7.4