[PATCH] D117542: [Coroutines] Offering llvm.coro.align intrinsic

Chuanqi Xu via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jan 17 23:32:17 PST 2022


ChuanqiXu created this revision.
ChuanqiXu added reviewers: rjmccall, ychen, ezhulenev, bkramer.
ChuanqiXu added a project: LLVM.
Herald added subscribers: Chia-hungDuan, rriddle, hiraditya.
ChuanqiXu requested review of this revision.
Herald added subscribers: llvm-commits, stephenneuendorffer, jdoerfert.

It is a known problem that we can't align the switch-based coroutine frame if the alignment exceeds std::max_align_t (which is 16 usually).

Previously, the switch coroutine is used for C++. And I image that the problem could be solved at the language side and we could implement the corresponding proposal.

However, MLIR uses switch-based coroutine now. And they meet the same question: https://github.com/llvm/llvm-project/issues/53148.  Luckily, the semantics of MLIR is less constraint than C++. So we could solve the problem in MLIR by offering a llvm.coro.align intrinsic. And the intrinsic should be able to be reused when we try to solve the problem in C++.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D117542

Files:
  llvm/docs/Coroutines.rst
  llvm/include/llvm/Analysis/TargetTransformInfoImpl.h
  llvm/include/llvm/IR/Intrinsics.td
  llvm/lib/Transforms/Coroutines/CoroInstr.h
  llvm/lib/Transforms/Coroutines/CoroInternal.h
  llvm/lib/Transforms/Coroutines/CoroSplit.cpp
  llvm/lib/Transforms/Coroutines/Coroutines.cpp
  llvm/test/Transforms/Coroutines/coro-align-01.ll
  llvm/test/Transforms/Coroutines/coro-align-02.ll
  llvm/test/Transforms/Coroutines/coro-align-03.ll
  llvm/test/Transforms/Coroutines/coro-align-04.ll
  llvm/test/Transforms/Coroutines/coro-align-05.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D117542.400737.patch
Type: text/x-patch
Size: 16082 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220118/3fe7faf7/attachment.bin>


More information about the llvm-commits mailing list