[PATCH] D101701: [RFC][nofree] Refine concurrency requirements

Nicolai Hähnle via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sat May 1 14:47:45 PDT 2021


nhaehnle created this revision.
nhaehnle added reviewers: reames, jdoerfert, nlopes, bollu.
Herald added subscribers: dexonsmith, okura, kuter, uenoku, jfb, hiraditya.
Herald added a reviewer: uenoku.
nhaehnle requested review of this revision.
Herald added a reviewer: sstefan1.
Herald added a reviewer: baziotis.
Herald added a subscriber: bbn.
Herald added a project: LLVM.

(Triggered by discussion on https://reviews.llvm.org/D100141, this is
a counter-proposal to https://reviews.llvm.org/D100676)

Declare that a `nofree` function cannot arrange for memory to be freed
that was dereferenceable before the call -- whether by (transitive) call
or by communication with another thread.

This is a simplification from the perspective of using the information
provided by the function attribute when optimizing the caller, at the
cost of complicating the inference of `nofree`.

This change arguably increases the expressive power of the IR, since we
can now have functions that are (usefully) `nofree` without being `nosync`.
Before this change, `nofree` on a not-`nosync` function does not do
anything.

The attributor is updated so that a function containing a volatile
memory operation or a release (or stronger) atomic operations is not
`nofree`. The reasoning behind only checking for release ordering is
explained in a code comment.

@jdoerfert: I have zero knowledge of the attributor infrastructure, so if
this direction is taken I'd appreciate a review specifically of those parts.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D101701

Files:
  llvm/docs/LangRef.rst
  llvm/lib/IR/Value.cpp
  llvm/lib/Transforms/IPO/AttributorAttributes.cpp
  llvm/test/Transforms/Attributor/nofree.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D101701.342181.patch
Type: text/x-patch
Size: 11826 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210501/1db989ca/attachment.bin>


More information about the llvm-commits mailing list