[PATCH] D103593: [Coroutine] Sink lifetime markers after switch of suspend blocks to avoid disturbing must tail calls

Chuanqi Xu via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jun 3 00:30:58 PDT 2021


ChuanqiXu created this revision.
ChuanqiXu added reviewers: lxfind, rjmccall, junparser.
Herald added a subscriber: hiraditya.
ChuanqiXu requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

This fixes bug 50544 <https://bugs.llvm.org/show_bug.cgi?id=50544>.

The original implementation would try to insert new lifetime markers between `coro.suspend` and the switch that uses `coro.suspends`. After lowering, it would make a pattern:

  fastcc call anything ; // should be musttail
  %0 = getelementptr ...
  lifetime.start(size, %0)
  ret void

which prevent the musttail call and it doesn't make sense actually. This patch tries to insert new lifetime markers after the switch block instead, which solves the bug and makes more sense.

Test Plan: check-all


https://reviews.llvm.org/D103593

Files:
  llvm/lib/Transforms/Coroutines/CoroFrame.cpp
  llvm/test/Transforms/Coroutines/coro-split-musttail4.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D103593.349466.patch
Type: text/x-patch
Size: 5210 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210603/fe006526/attachment.bin>


More information about the llvm-commits mailing list