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

Guillaume Chatelet via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed May 22 07:20:39 PDT 2019


gchatelet added a comment.

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`."
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.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D61634





More information about the llvm-commits mailing list