[PATCH] D137707: Move "auto-init" instructions to the dominator of their users
serge via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Nov 23 03:39:43 PST 2022
serge-sans-paille added a comment.
Thanks @efriedma for the (frightening) answer.
> If instead x is uninitialized, you run into basically the same thing with implicit zero init: it's illegal to sink the implicit zero-init of x past the fence, because it could race with stores on another thread.
As `x` is a stack allocated variable, in order to have it shared with another thread (and potentially generating race), we need to *use* it, which implies the initialization already happens. Why does it matter it's done before or after the fence?
If I understand correctly, the fence is global, which means basically any function call we don't have strong guarantee on could imply a memory fence, and prevent the sink, correct?
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D137707/new/
https://reviews.llvm.org/D137707
More information about the llvm-commits
mailing list