[PATCH] D124247: [Trivial Dead] Consider any non volatile load as trivially dead independent on ordering

Eli Friedman via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Apr 27 11:22:25 PDT 2022


efriedma added a comment.

> Sequential consistency adds total order of all seq_cst operations to release-acquire semantic. However If load is not used its total order does not matter, so only acquire semantic plays role here.

I'm not sure this is right, but I don't really have time to dig into it.  (Maybe you could end up in a situation where the result of an "acquire" load contradicts the total order, even if the seq_cst load is not used.

> Don't you think that adding the implementation above under the flag is more or less safe if it is off by default and we can consider it switching on some day in future. At least we can try to play with it...

Under your proposal, we'd need some way to specify that some particular set of loads is safe to optimize more aggressively.  Given that existing IR wouldn't have those markings, there's not really any point to turning off the feature by default?

More generally, if C++11 atomics aren't suitable for your use-case, it would make sense to look at other possibilities.  If you're interested in pursuing this, please start a thread on Discourse.


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

https://reviews.llvm.org/D124247



More information about the llvm-commits mailing list