At the moment, we mark every atomic memory access as being also volatile. This is unnecessarily conservative and prohibits many legal transforms (DCE, folding, etc..).
This patch is build on top of a series of other patches which adjust SelectionDAG code to (for the moment) be as conservative for an atomic access as for a volatile access.
Currently under review:
* D57802 Be conservative about unordered accesses for the moment
* D57593 Fix a bug in the definition of isUnordered on MachineMemOperand
* D57596 [CodeGen] Be conservative about atomic accesses as for volatile
The intention once all of these land is to apply this patch as an NFC. (i.e. there should be no change in behaviour associated with this patch) Once it's in and baked for a bit, we'll start working through removing unnecessary bailouts one by one. We applied this same strategy to the middle end a few years ago, with good success.
Note that before the patches above landed, we did see test failures with this change and there are none now left. (This a good sign.)
Work planned for once this is in, and has baked for a bit:
* D57803 [X86][GlobalISEL] Support lowering aligned unordered atomics
* ImplicitNullCheck for unordered loads
* load folding for unordered loads
* store folding for unordered stores
* load/store unfolding
* review of the other conservative bails outs inserted in pre-work for this patch