[PATCH] D127383: Don't treat readnone call in presplit coroutine as not access memory

Chuanqi Xu via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun Jul 17 20:26:24 PDT 2022


ChuanqiXu added inline comments.


================
Comment at: llvm/lib/Analysis/BasicAliasAnalysis.cpp:779
+        !Call->hasFnAttr(Attribute::InaccessibleMemOnly) &&
+        !Call->hasFnAttr(Attribute::InaccessibleMemOrArgMemOnly))))
     if (const Function *F = Call->getCalledFunction())
----------------
nikic wrote:
> Do we lose anything substantial with just the `Call->getFunction()->isPresplitCoroutine()` condition?
> 
> Alternatively, I would implement this as a fixup afterwards that looks something like this:
> 
> ```
> if (Call->getFunction()->isPreSplitCoroutine())
>   Min = FunctionModRefBehavior(Min | FMRB_OnlyReadsMemory);
> ```
For,

```
define void @f() presplitcoroutine  {
      entry:
        %ArgMemOnlyCall = call i32 @argmemonly_func()
        ret void
      }

      declare i32 @argmemonly_func() argmemonly
```

The current implementation would get `FMRB_OnlyAccessesArgumentPointees` for `ArgMemOnlyCall`. But the suggested change would get `FMRB_UnknownModRefBehavior`. I am OK with the suggested change if you feel like the benefit is not worth for the cost. I know compilation time is an important feature of Clang/LLVM.


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

https://reviews.llvm.org/D127383



More information about the llvm-commits mailing list