Allow unordered loads to be considered invariant in CodeGen
authorPhilip Reames <listmail@philipreames.com>
Tue, 19 Mar 2019 18:27:18 +0000 (18:27 +0000)
committerPhilip Reames <listmail@philipreames.com>
Tue, 19 Mar 2019 18:27:18 +0000 (18:27 +0000)
commitdb65a5b776f20795df41741bc7042d6b61070886
tree0f3b66a9bd3e3ad43733c3fffa5b3fc69c2dee84
parentc3608fc0d6e992cf8eb0eff1fab021eca85e41ca
Allow unordered loads to be considered invariant in CodeGen

The actual code change is fairly straight forward, but exercising it isn't. First, it turned out we weren't adding the appropriate flags in SelectionDAG. Second, it turned out that we've got some optimization gaps, so obvious test cases don't work.

My first attempt (in atomic-unordered.ll) points out a deficiency in our peephole-opt folding logic which I plan to fix separately. Instead, I'm exercising this through MachineLICM.

Differential Revision: https://reviews.llvm.org/D59375

llvm-svn: 356494
llvm/lib/CodeGen/MachineInstr.cpp
llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
llvm/test/CodeGen/X86/atomic-unordered.ll
llvm/test/CodeGen/X86/hoist-invariant-load.ll