GlobalISel: Fix unconditional fallback with global isel abort is disabled
authorTom Stellard <thomas.stellard@amd.com>
Fri, 18 Nov 2016 14:14:35 +0000 (14:14 +0000)
committerTom Stellard <thomas.stellard@amd.com>
Fri, 18 Nov 2016 14:14:35 +0000 (14:14 +0000)
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
llvm/test/CodeGen/AArch64/GlobalISel/gisel-abort.ll [new file with mode: 0644]

index 72e4a23..1d205cd 100644 (file)
@@ -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 (file)
index 0000000..76eafdd
--- /dev/null
@@ -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
+}
+