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

Teresa Johnson via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jan 7 09:55:58 PST 2020


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
>


I've listed below what I believe is the status:

>> 
>> 
>> 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>

Done (D68028 <https://reviews.llvm.org/D68028> committed at bd8791610948).

>> 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..)

Done (also in D68028 <https://reviews.llvm.org/D68028> committed at bd8791610948).
Additionally the -fno-builtin* options were translated to the IR attributes in D71193 <https://reviews.llvm.org/D71193> (committed at 0508c994f0b1 <https://reviews.llvm.org/rG0508c994f0b14144041f2cfd3ba9f9a80f03de08>).

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

Not done yet - I can work on this.

> 
> 
>> 4. Get inspiration from `TargetTransformInfo` to get `TargetLibraryInfo` on a per function basis for all passes and respect the IR attribute.

Done (D67923 <https://reviews.llvm.org/D67923> was the last patch in the series to enable this, committed at 878ab6df033d <https://reviews.llvm.org/rG878ab6df033d44430939c02075ee00800995dc3b>).

I'm not quite sure where D71710 <https://reviews.llvm.org/D71710> ([instrinsics] Add @llvm.memcpy.inline instrinsics) fits in to the above list.

Anything else missing?


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