MergeLoadStoreMotion and GVNHoist

Hello

I'm investigating a regression while bumping our target from llvm-4 to
llvm7. We see that common loads are no longer being hoisted by the
MergedLoadStoreMotion pass. We've tracked this issue down to [1]. My
understanding of [1] is that load hoisting is performed by GVNHoist and is
therefore no longer required to be duplicated by MLSM, but as far as I
can tell, GVNHoist is not enabled by default at any standard
optimization level [2][3][4] (it's hidden behind a flag). However the MLSM
code is enabled at any (level > 1).

Is this an oversight?

If this _is_ an oversight, does it make sense to now enable GVNHoist in the same
cases as MLSM i.e. at all optlevels > 1 ?

If not, what is the reason for not enabling this?

All the Best

Luke

[1] [0fbee48d](Remove the load hoisting code of MLSM, it is completely subsumed by G… · llvm-mirror/llvm@0fbee48 · GitHub)
[2] llvm/PassManagerBuilder.cpp at 3a58154548c4ed4a48a0a026b38fcea5167e931d · llvm-mirror/llvm · GitHub
[3] llvm/PassManagerBuilder.cpp at 3a58154548c4ed4a48a0a026b38fcea5167e931d · llvm-mirror/llvm · GitHub
[4] llvm/PassManagerBuilder.cpp at 3a58154548c4ed4a48a0a026b38fcea5167e931d · llvm-mirror/llvm · GitHub

I don't have an answer, but a small self-contained test that
demonstrates the issue may be helpful.
i

Hi,