From a0b4070813f6ea49536c5eb6bca3a03090bc7252 Mon Sep 17 00:00:00 2001 From: Vasileios Kalintiris Date: Tue, 28 Jul 2015 21:43:31 +0000 Subject: [PATCH] [mips][FastISel] Fix call lowering by bailing out on "fastcc" calls. Summary: Currently, we support only the MIPS O32 ABI calling convention for call lowering. With this change we avoid using the O32 calling convetion for lowering calls marked as using the fast calling convention. Reviewers: dsanders Subscribers: llvm-commits Differential Revision: http://reviews.llvm.org/D11515 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@243485 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Target/Mips/MipsFastISel.cpp | 9 +++++++++ test/CodeGen/Mips/Fast-ISel/fastcc-miss.ll | 16 ++++++++++++++++ 2 files changed, 25 insertions(+) create mode 100644 test/CodeGen/Mips/Fast-ISel/fastcc-miss.ll diff --git a/lib/Target/Mips/MipsFastISel.cpp b/lib/Target/Mips/MipsFastISel.cpp index 80d400b3440..2c88950f8fd 100644 --- a/lib/Target/Mips/MipsFastISel.cpp +++ b/lib/Target/Mips/MipsFastISel.cpp @@ -1245,6 +1245,10 @@ bool MipsFastISel::fastLowerCall(CallLoweringInfo &CLI) { const Value *Callee = CLI.Callee; MCSymbol *Symbol = CLI.Symbol; + // Do not handle FastCC. + if (CC == CallingConv::Fast) + return false; + // Allow SelectionDAG isel to handle tail calls. if (IsTailCall) return false; @@ -1422,6 +1426,11 @@ bool MipsFastISel::selectRet(const Instruction *I) { if (Ret->getNumOperands() > 0) { CallingConv::ID CC = F.getCallingConv(); + + // Do not handle FastCC. + if (CC == CallingConv::Fast) + return false; + SmallVector Outs; GetReturnInfo(F.getReturnType(), F.getAttributes(), Outs, TLI, DL); diff --git a/test/CodeGen/Mips/Fast-ISel/fastcc-miss.ll b/test/CodeGen/Mips/Fast-ISel/fastcc-miss.ll new file mode 100644 index 00000000000..7a197b112a2 --- /dev/null +++ b/test/CodeGen/Mips/Fast-ISel/fastcc-miss.ll @@ -0,0 +1,16 @@ +; RUN: llc < %s -march=mipsel -mcpu=mips32r2 -O0 -relocation-model=pic \ +; RUN: -fast-isel=true -mips-fast-isel -fast-isel-verbose 2>&1 | \ +; RUN: FileCheck %s + +; CHECK: FastISel missed call: +; CHECK-SAME: %call = call fastcc i32 @foo(i32 signext %a, i32 signext %b) + +define internal i32 @bar(i32 signext %a, i32 signext %b) { + %s = and i32 %a, %b + ret i32 %s +} + +define i32 @foo(i32 signext %a, i32 signext %b) { + %call = call fastcc i32 @foo(i32 signext %a, i32 signext %b) + ret i32 %call +}