[llvm] r233775 - [PowerPC] FastISel can't handle i1 return values when using CR bits

Hal Finkel hfinkel at anl.gov
Tue Mar 31 17:40:48 PDT 2015


Author: hfinkel
Date: Tue Mar 31 19:40:48 2015
New Revision: 233775

URL: http://llvm.org/viewvc/llvm-project?rev=233775&view=rev
Log:
[PowerPC] FastISel can't handle i1 return values when using CR bits

Under normal circumstances, use of CR bits is disabled when running at -O0, but
it is enabled by default otherwise, and if you have optnone functions, they'll
still generally be generated with crbits turned on (because nothing else turns
them off). FastISel can't handle most things dealing with i1 values when using
CR bits, and checks for that, but was not checking the return type on
functions; we can't fast-isel function calls with i1 return values either when
using CR bits for boolean values.

Fixes PR22664.

Added:
    llvm/trunk/test/CodeGen/PowerPC/optnone-crbits-i1-ret.ll
Modified:
    llvm/trunk/lib/Target/PowerPC/PPCFastISel.cpp

Modified: llvm/trunk/lib/Target/PowerPC/PPCFastISel.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/PowerPC/PPCFastISel.cpp?rev=233775&r1=233774&r2=233775&view=diff
==============================================================================
--- llvm/trunk/lib/Target/PowerPC/PPCFastISel.cpp (original)
+++ llvm/trunk/lib/Target/PowerPC/PPCFastISel.cpp Tue Mar 31 19:40:48 2015
@@ -1444,6 +1444,9 @@ bool PPCFastISel::fastLowerCall(CallLowe
   else if (!isTypeLegal(RetTy, RetVT) && RetVT != MVT::i16 &&
            RetVT != MVT::i8)
     return false;
+  else if (RetVT == MVT::i1 && PPCSubTarget->useCRBits())
+    // We can't handle boolean returns when CR bits are in use.
+    return false;
 
   // FIXME: No multi-register return values yet.
   if (RetVT != MVT::isVoid && RetVT != MVT::i8 && RetVT != MVT::i16 &&

Added: llvm/trunk/test/CodeGen/PowerPC/optnone-crbits-i1-ret.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/PowerPC/optnone-crbits-i1-ret.ll?rev=233775&view=auto
==============================================================================
--- llvm/trunk/test/CodeGen/PowerPC/optnone-crbits-i1-ret.ll (added)
+++ llvm/trunk/test/CodeGen/PowerPC/optnone-crbits-i1-ret.ll Tue Mar 31 19:40:48 2015
@@ -0,0 +1,37 @@
+; RUN: llc < %s | FileCheck %s
+target datalayout = "E-m:e-i64:64-n32:64"
+target triple = "powerpc64-bgq-linux"
+
+declare zeroext i1 @ri1()
+declare void @se1()
+declare void @se2()
+
+define void @test() #0 {
+entry:
+  %b = call zeroext i1 @ri1()
+  br label %next
+
+; CHECK-LABEL: @test
+; CHECK: bl ri1
+; CHECK-NEXT: nop
+; CHECK: andi. 3, 3, 1
+
+next:
+  br i1 %b, label %case1, label %case2
+
+case1:
+  call void @se1()
+  br label %end
+
+case2:
+  call void @se2()
+  br label %end
+
+end:
+  ret void
+
+; CHECK: blr
+}
+
+attributes #0 = { noinline optnone }
+





More information about the llvm-commits mailing list