efriedma added a comment. You could break `__builtin_load_with_control_dependency(x)` into something like `__builtin_control_dependency(READ_ONCE(x))`. I don't think any transforms will touch that in practice, even if it isn't theoretically sound. The rest of my suggestion still applies to that form, I think. They key point is that the compiler just needs to ensure some branch consumes the loaded value; it doesn't matter which branch it is.
The theoretical problem with separating the load from the branch is that it imposes an implicit contract: the branch has to use the value of the load as input, not an equivalent value produced some other way. This is the general problem with C++11 consume ordering, which nobody has tried to tackle. re: the memory clobber, LLVM understands acquire/release semantics for atomics; for example, you can write `__atomic_signal_fence(3)` in clang to get a "release" barrier. (I think that's what the email you linked is asking for?) Adding asm clobbers that are equivalent to the existing fences is probably feasible. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D103958/new/ https://reviews.llvm.org/D103958 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits