[PATCH] D66842: [AArch64][GlobalISel] Fall back when translating musttail calls

Jessica Paquette via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Aug 28 09:18:03 PDT 2019


This revision was automatically updated to reflect the committed changes.
Closed by commit rL370225: [AArch64][GlobalISel] Fall back when translating musttail calls (authored by paquette, committed by ).

Changed prior to commit:
  https://reviews.llvm.org/D66842?vs=217519&id=217669#toc

Repository:
  rL LLVM

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D66842/new/

https://reviews.llvm.org/D66842

Files:
  llvm/trunk/include/llvm/CodeGen/GlobalISel/CallLowering.h
  llvm/trunk/lib/CodeGen/GlobalISel/CallLowering.cpp
  llvm/trunk/lib/Target/AArch64/AArch64CallLowering.cpp
  llvm/trunk/test/CodeGen/AArch64/GlobalISel/call-translator-musttail.ll


Index: llvm/trunk/include/llvm/CodeGen/GlobalISel/CallLowering.h
===================================================================
--- llvm/trunk/include/llvm/CodeGen/GlobalISel/CallLowering.h
+++ llvm/trunk/include/llvm/CodeGen/GlobalISel/CallLowering.h
@@ -80,6 +80,9 @@
     Register SwiftErrorVReg = 0;
 
     MDNode *KnownCallees = nullptr;
+
+    /// True if the call must be tail call optimized.
+    bool IsMustTailCall = false;
   };
 
   /// Argument handling is mostly uniform between the four places that
Index: llvm/trunk/test/CodeGen/AArch64/GlobalISel/call-translator-musttail.ll
===================================================================
--- llvm/trunk/test/CodeGen/AArch64/GlobalISel/call-translator-musttail.ll
+++ llvm/trunk/test/CodeGen/AArch64/GlobalISel/call-translator-musttail.ll
@@ -0,0 +1,9 @@
+; RUN: not llc %s -mtriple aarch64-unknown-unknown -debug-only=aarch64-call-lowering -global-isel -o - 2>&1 | FileCheck %s
+
+; CHECK: Cannot lower musttail calls yet.
+; CHECK-NEXT: LLVM ERROR: unable to translate instruction: call (in function: foo)
+declare void @must_callee(i8*)
+define void @foo(i32*) {
+  musttail call void @must_callee(i8* null)
+  ret void
+}
Index: llvm/trunk/lib/Target/AArch64/AArch64CallLowering.cpp
===================================================================
--- llvm/trunk/lib/Target/AArch64/AArch64CallLowering.cpp
+++ llvm/trunk/lib/Target/AArch64/AArch64CallLowering.cpp
@@ -409,6 +409,11 @@
   MachineRegisterInfo &MRI = MF.getRegInfo();
   auto &DL = F.getParent()->getDataLayout();
 
+  if (Info.IsMustTailCall) {
+    LLVM_DEBUG(dbgs() << "Cannot lower musttail calls yet.\n");
+    return false;
+  }
+
   SmallVector<ArgInfo, 8> SplitArgs;
   for (auto &OrigArg : Info.OrigArgs) {
     splitToValueTypes(OrigArg, SplitArgs, DL, MRI, Info.CallConv);
Index: llvm/trunk/lib/CodeGen/GlobalISel/CallLowering.cpp
===================================================================
--- llvm/trunk/lib/CodeGen/GlobalISel/CallLowering.cpp
+++ llvm/trunk/lib/CodeGen/GlobalISel/CallLowering.cpp
@@ -62,6 +62,7 @@
       CS.getInstruction()->getMetadata(LLVMContext::MD_callees);
   Info.CallConv = CS.getCallingConv();
   Info.SwiftErrorVReg = SwiftErrorVReg;
+  Info.IsMustTailCall = CS.isMustTailCall();
 
   return lowerCall(MIRBuilder, Info);
 }


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D66842.217669.patch
Type: text/x-patch
Size: 2322 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190828/adc36537/attachment.bin>


More information about the llvm-commits mailing list