From 4934dfffb04dc8e479b8b74dc2455c82eecadbb0 Mon Sep 17 00:00:00 2001 From: Amara Emerson Date: Fri, 12 Apr 2019 22:05:46 +0000 Subject: [PATCH] [GlobalISel] Fix a crash when handling an invalid MVT during call lowering. This crash was introduced in r358032 as we try to construct an EVT from an MVT in order to find the register type for the calling conv. Fall back instead of trying to do this with an invalid MVT coming from i256. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@358314 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/CodeGen/GlobalISel/CallLowering.cpp | 2 +- .../CodeGen/AArch64/GlobalISel/call-lowering-i256-crash.ll | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-) create mode 100644 test/CodeGen/AArch64/GlobalISel/call-lowering-i256-crash.ll diff --git a/lib/CodeGen/GlobalISel/CallLowering.cpp b/lib/CodeGen/GlobalISel/CallLowering.cpp index 47fdeedaeb4..b6b1bef2600 100644 --- a/lib/CodeGen/GlobalISel/CallLowering.cpp +++ b/lib/CodeGen/GlobalISel/CallLowering.cpp @@ -125,7 +125,7 @@ bool CallLowering::handleAssignments(MachineIRBuilder &MIRBuilder, MVT CurVT = MVT::getVT(Args[i].Ty); if (Handler.assignArg(i, CurVT, CurVT, CCValAssign::Full, Args[i], CCInfo)) { // Try to use the register type if we couldn't assign the VT. - if (!Handler.isArgumentHandler()) + if (!Handler.isArgumentHandler() || !CurVT.isValid()) return false; CurVT = TLI->getRegisterTypeForCallingConv( F.getContext(), F.getCallingConv(), EVT(CurVT)); diff --git a/test/CodeGen/AArch64/GlobalISel/call-lowering-i256-crash.ll b/test/CodeGen/AArch64/GlobalISel/call-lowering-i256-crash.ll new file mode 100644 index 00000000000..2ebd7a78e51 --- /dev/null +++ b/test/CodeGen/AArch64/GlobalISel/call-lowering-i256-crash.ll @@ -0,0 +1,7 @@ +; RUN: llc -mtriple=aarch64-linux-gnu -O0 -verify-machineinstrs -o - %s | FileCheck %s + +define i1 @test_crash_i256(i256 %int) { +; CHECK-LABEL: test_crash_i256 +; CHECK: ret + ret i1 true +} -- 2.50.1