[PATCH] D91979: [Clang][Attr] Introduce the `assume` function attribute

Johannes Doerfert via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Nov 23 10:04:56 PST 2020


jdoerfert created this revision.
jdoerfert added reviewers: JonChesterfield, aaron.ballman, jhuber6.
Herald added a subscriber: bollu.
Herald added a project: clang.
jdoerfert requested review of this revision.
Herald added a subscriber: sstefan1.

The `assume` attribute is a way to provide additional, arbitrary
information to the optimizer. For now, assumptions are restricted to
strings which will be accumulated for a function and emitted as comma
separated string function attribute. The key of the LLVM-IR function
attribute is `llvm.assume`. Similar to `llvm.assume` and
`__builtin_assume`, the `assume` attribute provides a user defined
assumption to the compiler.

A follow up patch will introduce an LLVM-core API to query the
assumptions attached to a function. We also expect to add more options,
e.g., expression arguments, to the `assume` attribute later on.

The `omp [begin] asssumes` pragma will leverage this attribute and
expose the functionality in the absence of OpenMP.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D91979

Files:
  clang/docs/LanguageExtensions.rst
  clang/include/clang/Basic/Attr.td
  clang/include/clang/Basic/AttrDocs.td
  clang/lib/CodeGen/CGCall.cpp
  clang/lib/Sema/SemaDeclAttr.cpp
  clang/test/CodeGen/assume_attr.c
  clang/test/CodeGenCXX/assume_attr.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D91979.307113.patch
Type: text/x-patch
Size: 9903 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20201123/6e1a8f3d/attachment.bin>


More information about the cfe-commits mailing list