This is an archive of the discontinued LLVM Phabricator instance.

Remove the load hoisting code of MLSM, it is completely subsumed by GVNHoist
ClosedPublic

Authored by dberlin on Jan 24 2017, 4:54 AM.

Details

Summary

GVNHoist performs all the optimizations that MLSM does to loads, in a
more general way, and in a faster time bound (MLSM is N^3 in most
cases, N^4 in a few edge cases).

This disables the load portion.

Note that the way ld_hoist_st_sink.ll is written makes one think that
the loads should be moved to the while.preheader block, but

  1. Neither MLSM nor GVNHoist do it (they both move them to identical places).
  1. MLSM couldn't possibly do it anyway, as the while.preheader block

is not the head of the diamond, while.body is. (GVNHoist could do it
if it was legal).

  1. At a glance, it's not legal anyway because the in-loop load

conflict with the in-loop store, so the loads must stay in-loop.

I am happy to update the test to use update_test_checks so that
checking is tighter, just was going to do it as a followup.

Note that i can find no particular benefit to the store portion on any
real testcase/benchmark i have (even size-wise). If we really still
want it, i am happy to commit to writing a targeted store sinker, just
taking the code from the MemorySSA port of MergedLoadStoreMotion
(which is N^2 worst case, and N most of the time).

We can do what it does in a much better time bound.

We also should be both hoisting and sinking stores, not just sinking
them, anyway, since whether we should hoist or sink to merge depends
basically on luck of the draw of where the blockers are placed.

Nonetheless, i have left it alone for now.

Diff Detail

Repository
rL LLVM

Event Timeline

dberlin created this revision.Jan 24 2017, 4:54 AM
davide accepted this revision.Jan 24 2017, 7:26 AM

This is really great =)

This revision is now accepted and ready to land.Jan 24 2017, 7:26 AM
This revision was automatically updated to reflect the committed changes.
llvm/trunk/test/Transforms/InstMerge/ld_hoist1.ll