]> granicus.if.org Git - llvm/commitdiff
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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@287344 91177308-0d34-0410-b5e6-96231b3b80d8

lib/CodeGen/GlobalISel/InstructionSelect.cpp
test/CodeGen/AArch64/GlobalISel/gisel-abort.ll [new file with mode: 0644]

index 72e4a23bb407a61f966bbb24325d5ba71412cf1e..1d205cd6c9c8b99e2f98f41b9838385c76c8cfe8 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/test/CodeGen/AArch64/GlobalISel/gisel-abort.ll b/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
+}
+