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

via llvm-commits llvm-commits at lists.llvm.org
Sun Oct 1 12:51:27 PDT 2023


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-backend-arm

<details>
<summary>Changes</summary>

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.

---
Full diff: https://github.com/llvm/llvm-project/pull/67932.diff


1 Files Affected:

- (modified) llvm/lib/Target/ARM/ARMTargetTransformInfo.h (+8) 


``````````diff
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();
+  }
+
   /// @}
 };
 

``````````

</details>


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


More information about the llvm-commits mailing list