[PATCH] D97676: [DSE] Extending isOverwrite to support offsetted fully overlapping stores

Matteo Favaro via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Mar 1 03:50:51 PST 2021


fvrmatteo created this revision.
fvrmatteo added a reviewer: fhahn.
Herald added subscribers: javed.absar, hiraditya.
fvrmatteo requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

The **isOverwrite** function is making sure to identify if two stores are fully overlapping and ideally we would like to identify all the instances of OW_Complete as they'll yield possibly killable stores. The current implementation is incapable of spotting instances where the earlier store is offsetted compared to the later store, but still fully overlapped. The limitation seems to lie on the computation of the base pointers with the **GetPointerBaseWithConstantOffset** API that often yields different base pointers even if the stores are guaranteed to partially overlap (e.g. the alias analysis is returning AliasResult::PartialAlias).

I'm pretty sure the introduction of the ScalarEvolution analysis dependency is suboptimal, but I thought about providing a test case and a possible solution to the problem for the moment, as from my tests the obtained SCEV expressions yield better results and the stores "difference" computation is straightforward.

Testing with `ninja check-llvm` didn't throw unexpected failures but I'll gladly update the patch and run more tests if this is something worth adding to the DSE pass.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D97676

Files:
  llvm/lib/Transforms/Scalar/DeadStoreElimination.cpp
  llvm/test/Transforms/DeadStoreElimination/MSSA/offsetted-overlapping-stores.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D97676.327071.patch
Type: text/x-patch
Size: 12535 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210301/5c75c4b5/attachment-0001.bin>


More information about the llvm-commits mailing list