[PATCH] D101701: [nofree] Refine concurrency requirements

Nicolai Hähnle via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun Jul 25 00:37:59 PDT 2021


nhaehnle added a comment.

Quick clarification:

In D101701#2902713 <https://reviews.llvm.org/D101701#2902713>, @jdoerfert wrote:

> Let's assume this is our entire module:
>
>   static int *X = nullptr;
>   
>   int readX() { return *X; }
>   
>   void foo() {
>     if (!X)
>       X = malloc(4);  // let it be known in the module.
>   }
>   
>   void bar() {
>     *X = 1;
>     unknown_inaccessible_mem_only_but_not_nosync();   // e.g. malloc
>     argmemonly_nofree_but_not_nosync(X);              // can be derived from the definition of the function and attribute can be made available through HTO or thinLTO.
>     // X is still deref here because no thread could have freed it.
>   }
>
> X is in the entire module `deref_or_null(4)` but only because we have `inaccessible_mem_only` (malloc) and `argmemonly` + `nofree` (definition + HTO/thinLTO).
> `nosync` is not set for any of the functions.

You really also need `nocapture` on the argument of `argmemonly_nofree_but_not_nosync` for this to work, right?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D101701/new/

https://reviews.llvm.org/D101701



More information about the llvm-commits mailing list