From 4fa6ecc26fe82f0cac9e0c4aed9fa45ecf8338e7 Mon Sep 17 00:00:00 2001 From: Juergen Ributzka Date: Wed, 23 Jul 2014 20:03:13 +0000 Subject: [PATCH] [FastISel][AArch64] Fix return type in FastLowerCall. I used the wrong method to obtain the return type inside FinishCall. This fix simply uses the return type from FastLowerCall, which we already determined to be a valid type. Reduced test case from Chad. Thanks. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@213788 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Target/AArch64/AArch64FastISel.cpp | 8 ++++---- test/CodeGen/AArch64/fast-isel-call-return.ll | 12 ++++++++++++ 2 files changed, 16 insertions(+), 4 deletions(-) create mode 100644 test/CodeGen/AArch64/fast-isel-call-return.ll diff --git a/lib/Target/AArch64/AArch64FastISel.cpp b/lib/Target/AArch64/AArch64FastISel.cpp index f621246a7b3..c042447ce5b 100644 --- a/lib/Target/AArch64/AArch64FastISel.cpp +++ b/lib/Target/AArch64/AArch64FastISel.cpp @@ -138,7 +138,7 @@ private: CCAssignFn *CCAssignFnForCall(CallingConv::ID CC) const; bool ProcessCallArgs(CallLoweringInfo &CLI, SmallVectorImpl &ArgVTs, unsigned &NumBytes); - bool FinishCall(CallLoweringInfo &CLI, unsigned NumBytes); + bool FinishCall(CallLoweringInfo &CLI, MVT RetVT, unsigned NumBytes); public: // Backend specific FastISel code. @@ -1270,9 +1270,9 @@ bool AArch64FastISel::ProcessCallArgs(CallLoweringInfo &CLI, return true; } -bool AArch64FastISel::FinishCall(CallLoweringInfo &CLI, unsigned NumBytes) { +bool AArch64FastISel::FinishCall(CallLoweringInfo &CLI, MVT RetVT, + unsigned NumBytes) { CallingConv::ID CC = CLI.CallConv; - MVT RetVT = MVT::getVT(CLI.RetTy); // Issue CALLSEQ_END unsigned AdjStackUp = TII.getCallFrameDestroyOpcode(); @@ -1370,7 +1370,7 @@ bool AArch64FastISel::FastLowerCall(CallLoweringInfo &CLI) { MIB.addRegMask(TRI.getCallPreservedMask(CC)); // Finish off the call including any return values. - return FinishCall(CLI, NumBytes); + return FinishCall(CLI, RetVT, NumBytes); } bool AArch64FastISel::IsMemCpySmall(uint64_t Len, unsigned Alignment) { diff --git a/test/CodeGen/AArch64/fast-isel-call-return.ll b/test/CodeGen/AArch64/fast-isel-call-return.ll new file mode 100644 index 00000000000..22cb35d99ab --- /dev/null +++ b/test/CodeGen/AArch64/fast-isel-call-return.ll @@ -0,0 +1,12 @@ +; RUN: llc -fast-isel -fast-isel-abort < %s | FileCheck %s +target datalayout = "e-m:e-i64:64-i128:128-n32:64-S128" +target triple = "aarch64-linux-gnu" + +define i8* @test_call_return_type(i64 %size) { +entry: +; CHECK: bl xmalloc + %0 = call noalias i8* @xmalloc(i64 undef) + ret i8* %0 +} + +declare noalias i8* @xmalloc(i64) -- 2.34.1