[PATCH] D156451: GVNSink: port some tests from MergedLoadStoreMotion

Ramkumar Ramachandra via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jul 27 09:28:04 PDT 2023


artagnon created this revision.
artagnon added reviewers: jmolloy, jeroen.dobbelaere, nikic, lebedev.ri, xbolva00.
Herald added a subscriber: StephenFan.
Herald added a project: All.
artagnon requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

GVNSink has not had much work put into it, ever since it was first
introduced six years ago, and is not turned on by default. While it is
similar to MergedLoadStoreMotion, a pass which is enabled by default, it
can operate on cases where mldst-motion fails. As an example of
GVNSink's capabilities, consider:

  void BeamFormWeights(int a[20000], int beam) {
    for (int i = 0; i < 10000; ++i) {
      if (i == beam)
        a[2 * i] = 0;
      else
        a[2 * i] = 1;
    }
  }

mldst-motion fails to sink the store in this case, because GVN's
operation rewrote the first GEP from 2 * i to 2 * beam, and the two GEPs
in the different branches fail to match up. Indeed, the only solution to
optimizing the above example is a GVN-aware sinking-pass, and GVNSink
promises to be that pass.

Unfortunately, since GVNSink has not seen much activity, its status is
unclear: it is unclear what the outstanding bugs are, and a quick
benchmark run with GVNSink turned on shows significant regressions.

This patch is a first step to better understand the status of GVNSink:
it ports three tests from mldst-motion which pass out-of-the-box. The
other tests from mldst-motion do not pass when ported over, and
follow-ups could involve fixing legitimate problems in GVNSink, and
adding corresponding tests.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D156451

Files:
  llvm/test/Transforms/GVNSink/barrier-call.ll
  llvm/test/Transforms/GVNSink/load-barrier.ll
  llvm/test/Transforms/GVNSink/no-barrier-store.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D156451.544818.patch
Type: text/x-patch
Size: 5075 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230727/8809b6cc/attachment.bin>


More information about the llvm-commits mailing list