[PATCH] D125292: [Coroutines] Introduce "coro_readnone" operand bundles (2/3)

Chuanqi Xu via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon May 9 23:56:59 PDT 2022


ChuanqiXu created this revision.
Herald added subscribers: jdoerfert, hiraditya.
Herald added a project: All.
ChuanqiXu requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

This belongs to a series of patches which try to solve the thread identification problem in coroutines. See https://discourse.llvm.org/t/address-thread-identification-problems-with-coroutine/62015 for a full background.

This patch tries to solve the `readnone` problem by removing the `readnone` attributes for calls in a coroutine in CoroEarly pass. And we would add the `readnone` attribute back after the coroutine get split in CoroCleanup pass. To record the calls we removed the attribute and block unexpect optimizations, we introduced "coro_readnone" operand bundles.

Why operand bundles instead of another attribute on the callsite?

Since when the compiler query whether a call is `readnone`, it would try to lookup to the callee declaration of the call if it failed to find the attribute at the callsite. See https://github.com/llvm/llvm-project/blob/3b762b3ab8d205cd6a7d42c96d39d5f4f701f2ab/llvm/include/llvm/IR/InstrTypes.h#L2315-L2325


https://reviews.llvm.org/D125292

Files:
  llvm/docs/LangRef.rst
  llvm/include/llvm/IR/LLVMContext.h
  llvm/lib/IR/LLVMContext.cpp
  llvm/lib/Transforms/Coroutines/CoroCleanup.cpp
  llvm/lib/Transforms/Coroutines/CoroEarly.cpp
  llvm/lib/Transforms/Utils/InlineFunction.cpp
  llvm/test/Bitcode/operand-bundles-bc-analyzer.ll
  llvm/test/Transforms/Coroutines/coro-readnone-01.ll
  llvm/test/Transforms/Coroutines/coro-readnone-02.ll
  llvm/test/Transforms/Coroutines/coro-readnone-03.ll
  llvm/test/Transforms/Coroutines/coro-readnone-04.ll
  llvm/test/Transforms/Coroutines/coro-readnone-05.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D125292.428299.patch
Type: text/x-patch
Size: 19879 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220510/5fc60ee8/attachment.bin>


More information about the llvm-commits mailing list