[PATCH] D61634: [clang/llvm] Allow efficient implementation of libc's memory functions in C/C++

Teresa Johnson via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Jul 15 10:45:47 PDT 2019


tejohnson added a comment.

In D61634#1515176 <https://reviews.llvm.org/D61634#1515176>, @tejohnson wrote:

> In D61634#1512020 <https://reviews.llvm.org/D61634#1512020>, @gchatelet wrote:
>
> > AFAIU here is a coarse plan of what needs to happen
> >
> > 1. Add a `no-builtin` clang function attribute that has the same semantic as the `no-builtin` cmd line argument <https://clang.llvm.org/docs/ClangCommandLineReference.html#cmdoption-clang-fbuiltin>
> > 2. Propagate it to the IR.
> >   - In the light of recent discussions and as @theraven suggested it seems more appropriate to encode them as individual IR attributes (e.g. `"no-builtin-memcpy"`, `"no-builtin-sqrt"`, etc..)
> > 3. Propagate/merge the `no-builtin` IR attribute for LTO by "updating `AttributeFuncs::areInlineCompatible` and/or `AttributeFuncs::mergeAttributesForInlining` and adding a new MergeRule in `include/llvm/IR/Attributes.td` and writing a function like `adjustCallerStackProbeSize`."
>
>
> This one isn't about LTO, but rather the inliner. You could have different functions in the same module even without LTO that have incompatible no-builtin attributes. There isn't any propagation required for LTO.
>
> > 4. Get inspiration from `TargetTransformInfo` to get `TargetLibraryInfo` on a per function basis for all passes and respect the IR attribute.
> > 
> >   I'm not familiar with 3 and 4 but I can definitely have a look. I'll update this patch to do 1 and 2 in the meantime. @tejohnson let me know how you want to proceed for your related patch <https://reviews.llvm.org/D60162>. I'm happy to help if I can.
>
> I will mark that one obsolete. I can work on 4, it may just take some time to get it all plumbed.


Checking in to see where we are on this issue. I haven't had any time to work on 4 but hopefully can start on that soon. But it needs the first part done to be effective.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D61634





More information about the cfe-commits mailing list