[PATCH] D50125: [FunctionAttrs] Annotate function arguments with call site information

Johannes Doerfert via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jul 31 19:17:25 PDT 2018


jdoerfert created this revision.
jdoerfert added reviewers: hfinkel, homerdin, chandlerc.
Herald added a subscriber: bollu.

If a function is internal and all call sites are statically known, we can
try to derive attributes for the arguments. With this patch we introduce
this attribute deduction for the following attributes:

- non-null
- no-capture
- read-none
- read-only
- write-only
- no-alias
- alignment
- dereferencable
- dereferencable_or_null

Note that many internal functions are inlined, but some are not. This
could be caused by size constrains, recursion, or because the internal
function is used as a "callback", thus an indirect call that might or
might not be visible in the current module. While this patch does not
require callback calls to be identified, it is especially designed to
allow them later on. One type of callback that can significantly benefit
from proper attribute deduction are outlined functions passed to OpenMP
runtime calls. Though, in practice we see various kinds of callbacks
including user defined higher-order functions and calls to builtins like
qsort.


Repository:
  rL LLVM

https://reviews.llvm.org/D50125

Files:
  lib/Transforms/IPO/FunctionAttrs.cpp
  test/Other/opt-O2-pipeline.ll
  test/Other/opt-O3-pipeline.ll
  test/Other/opt-Os-pipeline.ll
  test/Other/pass-pipelines.ll
  test/Transforms/FunctionAttrs/internal_callee.ll
  test/Transforms/FunctionAttrs/internal_noalias.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D50125.158452.patch
Type: text/x-patch
Size: 45392 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180801/4191ed99/attachment.bin>


More information about the llvm-commits mailing list