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
The method would only try to process coroutines only to avoid affecting thousands of normal functions.
@rjmccall Could we remove the check now? If yes, we could add a check in the beginning of the function to return quickly for normal functions.