[PATCH] D29079: Remove the load hoisting code of MLSM, it is completely subsumed by GVNHoist

Daniel Berlin via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jan 24 04:55:00 PST 2017


dberlin created this revision.

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).

2. 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).

3. 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.


https://reviews.llvm.org/D29079

Files:
  lib/Transforms/Scalar/MergedLoadStoreMotion.cpp
  test/Transforms/GVNHoist/ld_hoist1.ll
  test/Transforms/GVNHoist/ld_hoist_st_sink.ll
  test/Transforms/InstMerge/ld_hoist1.ll
  test/Transforms/InstMerge/ld_hoist_st_sink.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D29079.85572.patch
Type: text/x-patch
Size: 9718 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170124/e5b7d332/attachment.bin>


More information about the llvm-commits mailing list