[llvm] r358314 - [GlobalISel] Fix a crash when handling an invalid MVT during call lowering.

Amara Emerson via llvm-commits llvm-commits at lists.llvm.org
Fri Apr 12 15:05:46 PDT 2019


Author: aemerson
Date: Fri Apr 12 15:05:46 2019
New Revision: 358314

URL: http://llvm.org/viewvc/llvm-project?rev=358314&view=rev
Log:
[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.

Added:
    llvm/trunk/test/CodeGen/AArch64/GlobalISel/call-lowering-i256-crash.ll
Modified:
    llvm/trunk/lib/CodeGen/GlobalISel/CallLowering.cpp

Modified: llvm/trunk/lib/CodeGen/GlobalISel/CallLowering.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/GlobalISel/CallLowering.cpp?rev=358314&r1=358313&r2=358314&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/GlobalISel/CallLowering.cpp (original)
+++ llvm/trunk/lib/CodeGen/GlobalISel/CallLowering.cpp Fri Apr 12 15:05:46 2019
@@ -125,7 +125,7 @@ bool CallLowering::handleAssignments(Mac
     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));

Added: llvm/trunk/test/CodeGen/AArch64/GlobalISel/call-lowering-i256-crash.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/AArch64/GlobalISel/call-lowering-i256-crash.ll?rev=358314&view=auto
==============================================================================
--- llvm/trunk/test/CodeGen/AArch64/GlobalISel/call-lowering-i256-crash.ll (added)
+++ llvm/trunk/test/CodeGen/AArch64/GlobalISel/call-lowering-i256-crash.ll Fri Apr 12 15:05:46 2019
@@ -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
+}




More information about the llvm-commits mailing list