[llvm] [ARM] Expose supportsTailCalls in ARMTargetTransformInfo (PR #67932)

Matthew Mirvish via llvm-commits llvm-commits at lists.llvm.org
Sun Oct 1 12:50:16 PDT 2023


https://github.com/mincrmatt12 created https://github.com/llvm/llvm-project/pull/67932

The ARM target doesn't support tail calls on certain older subarchitectures, however this information is not communicated to the target transform information. This causes coroutine symmetric transfer to fail as it adds musttail attributes which throw an assert during code generation. Exposing the underlying subtarget's `supportsTailCall` method to transforms (specifically the coroutine ones) allows coroutines to compile without crashing on these older subarchitectures (like ARMv6 on a Cortex-M0+)

See also 0b5ead65 and d2d77e0.

>From 13b1d743b2851d4020f8c3a528a6798a32bde806 Mon Sep 17 00:00:00 2001
From: Matthew Mirvish <matthew at mm12.xyz>
Date: Sun, 1 Oct 2023 15:42:12 -0400
Subject: [PATCH] [ARM] Expose supportsTailCalls in ARMTargetTransformInfo

The ARM target doesn't support tail calls on certain older
architectures, however this information is not communicated to the
target transform information. This causes coroutine symmetric transfer
to fail as it adds musttail attributes which throw an assert during
code generation.
---
 llvm/lib/Target/ARM/ARMTargetTransformInfo.h | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/llvm/lib/Target/ARM/ARMTargetTransformInfo.h b/llvm/lib/Target/ARM/ARMTargetTransformInfo.h
index bb4b321b5300916..95cd1442e689299 100644
--- a/llvm/lib/Target/ARM/ARMTargetTransformInfo.h
+++ b/llvm/lib/Target/ARM/ARMTargetTransformInfo.h
@@ -333,6 +333,14 @@ class ARMTTIImpl : public BasicTTIImplBase<ARMTTIImpl> {
 
   bool hasArmWideBranch(bool Thumb) const;
 
+  bool supportsTailCalls() const {
+    return ST->supportsTailCall();
+  }
+
+  bool supportsTailCallFor(const CallBase *CB) const {
+    return supportsTailCalls();
+  }
+
   /// @}
 };
 



More information about the llvm-commits mailing list