This is an archive of the discontinued LLVM Phabricator instance.

[WebAssembly] Don't set musttail for coroutines is tail call is not enabled
ClosedPublic

Authored by ChuanqiXu on Jun 29 2022, 2:26 AM.

Details

Summary

The C++20 Coroutines couldn't be compiled to WebAssembly due to an optimization named symmetric transfer requires the support for musttail calls but WebAssembly doesn't support it yet. This revision tried to address the opinion from https://reviews.llvm.org/D128163 by adding a new method to TTI.

Diff Detail

Event Timeline

ChuanqiXu created this revision.Jun 29 2022, 2:26 AM
Herald added a project: Restricted Project. · View Herald TranscriptJun 29 2022, 2:26 AM
ChuanqiXu requested review of this revision.Jun 29 2022, 2:26 AM
Herald added a project: Restricted Project. · View Herald TranscriptJun 29 2022, 2:26 AM
ChuanqiXu added inline comments.Jun 29 2022, 2:29 AM
llvm/test/Transforms/Coroutines/coro-split-musttail8.ll
3

I want another test to show the musttail could be added successfully if we enable tail call for warm. I tried to append -mattr=tail-call, -mattr=+tail-call. But both of them are failed. Do you have any suggestion here?

tlively accepted this revision.Jun 29 2022, 10:36 AM

Nice! LGTM with those comments.

llvm/include/llvm/Analysis/TargetTransformInfo.h
780

"supportTailCall" should probably be either "supportsTailCall" or even better "supportsTailCalls" everywhere it appears.

llvm/test/Transforms/Coroutines/coro-split-musttail8.ll
3

One option would be to append target feature metadata to the function:

attributes #0  = { "target-features"="+tail-call" }
This revision is now accepted and ready to land.Jun 29 2022, 10:36 AM
ChuanqiXu updated this revision to Diff 441238.Jun 29 2022, 8:18 PM

Address comments.

This revision was landed with ongoing or failed builds.Jun 29 2022, 8:19 PM
This revision was automatically updated to reflect the committed changes.