================ @@ -167,6 +167,53 @@ class CoroCloner { } // end anonymous namespace +// FIXME: +// Lower the intrinisc in CoroEarly phase if coroutine frame doesn't escape +// and it is known that other transformations, for example, sanitizers +// won't lead to incorrect code. +static void lowerAwaitSuspend(IRBuilder<> &Builder, CoroAwaitSuspendInst *CB) { + auto Wrapper = CB->getWrapperFunction(); + auto Awaiter = CB->getAwaiter(); + auto FramePtr = CB->getFrame(); + + Builder.SetInsertPoint(CB); + + CallBase *NewCall = nullptr; + if (auto Invoke = dyn_cast<InvokeInst>(CB)) { + auto WrapperInvoke = + Builder.CreateInvoke(Wrapper, Invoke->getNormalDest(), + Invoke->getUnwindDest(), {Awaiter, FramePtr}); + + WrapperInvoke->setCallingConv(Invoke->getCallingConv()); + std::copy(Invoke->bundle_op_info_begin(), Invoke->bundle_op_info_end(), + WrapperInvoke->bundle_op_info_begin()); + AttributeList NewAttributes = + Invoke->getAttributes().removeParamAttributes(Invoke->getContext(), 2); ---------------- ChuanqiXu9 wrote:
What is the attribute to be removed? Let's add a comment here to make it clear. https://github.com/llvm/llvm-project/pull/79712 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits