[PATCH] D137707: Move "auto-init" instructions to the dominator of their users

Eli Friedman via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Nov 29 11:01:57 PST 2022


efriedma added a comment.

> we move the memory initialization marked as "auto-init" before that dominator

The problem with this is that "before" in the sense of dominators isn't sufficient; that only dictates ordering on the CPU the code is executing on.  You need happens-before, i.e. the ordering visible to all CPUs, to ensure you don't have a race.

The user is responsible for ensuring there's a barrier between the allocation of the variable and the use, but if the auto-init is in a different place, you can't depend on the barrier the user wrote.


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

https://reviews.llvm.org/D137707



More information about the llvm-commits mailing list