[PATCH] D139295: [Coroutines] Don't mark the parameter attribute of resume function as noalias

Chuanqi Xu via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun Dec 11 17:50:14 PST 2022


ChuanqiXu added a comment.

In D139295#3986273 <https://reviews.llvm.org/D139295#3986273>, @nikic wrote:

> In D139295#3983358 <https://reviews.llvm.org/D139295#3983358>, @ChuanqiXu wrote:
>
>> In D139295#3978335 <https://reviews.llvm.org/D139295#3978335>, @nikic wrote:
>>
>>> @ChuanqiXu Your first function already contains:
>>>
>>>   store i32 42, ptr %__promise.reload.addr.i.i, align 8, !tbaa !3, !alias.scope !18
>>>   store ptr null, ptr %.reload.addr, align 8, !alias.scope !18
>>>   %1 = load ptr, ptr %0, align 8
>>>   musttail call fastcc void %1(ptr nonnull %0) #5, !noalias !18
>>>
>>> which says that the store and the call don't alias. I don't think the `noalias` argument on the function would even matter in that case. The incorrect noalias metadata must be introduced at some earlier point already.
>>
>> Oh, so I misunderstood the semantics of `!noalias` before. So this patch may not be correct. BTW, do you have any ideas why the `store` in the first function would't be optimized out?
>
> This is because the caller may read it. After inlining, we see that it's an alloca that nobody reads afterwards.

Oh, I got it. Thanks for clarification!


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D139295/new/

https://reviews.llvm.org/D139295



More information about the llvm-commits mailing list