[PATCH] D100464: [DSE] Remove stores in the same loop iteration

Dave Green via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu May 13 02:54:06 PDT 2021


dmgreen updated this revision to Diff 345077.
dmgreen added a comment.

Hello. OK. I'm back

This makes two changes. isOverwrite now checks IsGuaranteedLoopInvariant, returning OW_Unknown if they are not loop invariant. Otherwise we cannot trust the MustAlias that AA provides.
It also limits the IsGuaranteedLoopInvariant check from including global scope, only checking inside the same loop (or same block). This should hopefully limit the iterating on blocks that are very unlikely to be helpful.

Together these can mean we keep removing stores in loops, but does mean that certain partial alias overlaps that were removed before may no longer be. I don't believe those will come up very often though.

This removes some extra stores in the llvm test suite:

  Metric: dse.NumRemainingStores
  test-suite...nchmarkGame/spectral-norm.test     9.00     7.00   -22.2%
  test-suite...abench/jpeg/jpeg-6a/cjpeg.test   6029.00  5709.00  -5.3%
  test-suite...nsumer-jpeg/consumer-jpeg.test   6171.00  5851.00  -5.2%
  test-suite...nchmarks/Misc/ReedSolomon.test   248.00   239.00   -3.6%
  test-suite...s/ASC_Sequoia/AMGmk/AMGmk.test   220.00   216.00   -1.8%
  test-suite...marks/Ptrdist/yacr2/yacr2.test   314.00   310.00   -1.3%
  test-suite...nchmarks/McCat/18-imp/imp.test   143.00   142.00   -0.7%
  test-suite...ocBench/espresso/espresso.test   1776.00  1772.00  -0.2%
  test-suite...pplications/oggenc/oggenc.test   4174.00  4165.00  -0.2%
  test-suite.../Benchmarks/nbench/nbench.test   1375.00  1373.00  -0.1%
  test-suite...lications/ClamAV/clamscan.test   10107.00 10099.00 -0.1%
  test-suite...arks/mafft/pairlocalalign.test   5967.00  5963.00  -0.1%
  test-suite...nsumer-lame/consumer-lame.test   4615.00  4612.00  -0.1%
  test-suite...lications/sqlite3/sqlite3.test   16485.00 16478.00 -0.0%
  test-suite...marks/7zip/7zip-benchmark.test   32005.00 31993.00 -0.0%
  test-suite...ications/JM/lencod/lencod.test   13650.00 13645.00 -0.0%
  test-suite...ications/JM/ldecod/ldecod.test   6124.00  6122.00  -0.0%
  test-suite...rks/tramp3d-v4/tramp3d-v4.test   49150.00 49144.00 -0.0%
  test-suite...-typeset/consumer-typeset.test   22146.00 22144.00 -0.0%
  test-suite.../Benchmarks/Bullet/bullet.test   26355.00 26354.00 -0.0%

The number of defchecks and walks generally goes up a little on average, whilst the number of override checks goes down. But different cases can act very differently. sqlite is still doing more work.

WDYT? This is hopefully conservatively correct. Let me know if you think of ways it would not be.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D100464/new/

https://reviews.llvm.org/D100464

Files:
  llvm/lib/Transforms/Scalar/DeadStoreElimination.cpp
  llvm/test/CodeGen/AMDGPU/opt-pipeline.ll
  llvm/test/Other/opt-O2-pipeline.ll
  llvm/test/Other/opt-O3-pipeline-enable-matrix.ll
  llvm/test/Other/opt-O3-pipeline.ll
  llvm/test/Other/opt-Os-pipeline.ll
  llvm/test/Transforms/DeadStoreElimination/multiblock-loops.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D100464.345077.patch
Type: text/x-patch
Size: 37516 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210513/777704ee/attachment.bin>


More information about the llvm-commits mailing list