[PATCH] D156793: [TailCallElim] Remove the readonly attribute of byval.

Alexey Lapshin via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Aug 2 05:17:22 PDT 2023


avl added a reviewer: efriedma.
avl added inline comments.


================
Comment at: llvm/lib/Transforms/Scalar/TailRecursionElimination.cpp:683
+      // attribute is removed.
+      F.removeParamAttr(I, Attribute::ReadOnly);
       ArgumentPHIs[I]->addIncoming(F.getArg(I), BB);
----------------
probably, instead of removing readonly attribute we could stop generating it? Otherwise it will be presented or not depending of whether tail recursion elimination is happened.

```
byval(<ty>)

    This indicates that the pointer parameter should really be passed by value to the function. The attribute implies that a hidden copy of the pointee is made between the caller and the callee, so the callee is unable to modify the value in the caller.

```

The hidden copy protects original value from modifications done by callee. Having readonly attribute for hidden copy, probably, redundant.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D156793



More information about the llvm-commits mailing list