[PATCH] D110742: [OpenCL] Add pure and const attributes to vload builtins

Stuart Brady via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Sep 29 11:08:36 PDT 2021


stuart created this revision.
stuart added reviewers: svenvh, Anastasia, airlied, yaxunl.
Herald added a subscriber: ldrumm.
stuart requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

Use the `pure` and `const` attributes for the `vload`, `vload_half` and `vloada_half` builtins.

For the //global//, //local//, //private// and //generic// address spaces, the `pure` attribute (or `readonly`) can be used.

For the //constant// address space, the `const` attribute (or `readnone`) can be used.  As memory in the //constant// address space is immutable, the statement in the langref that: "if a `readnone` function reads or writes memory visible to the program, or has other side-effects, the behavior is undefined" does not apply.  The reading of immutable memory does not have side-effects, nor can it be affected by side-effects.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D110742

Files:
  clang/lib/Headers/opencl-c.h
  clang/lib/Sema/OpenCLBuiltins.td

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D110742.375963.patch
Type: text/x-patch
Size: 50327 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20210929/a80cf8cd/attachment-0001.bin>


More information about the cfe-commits mailing list