[PATCH] D15537: limit the number of instructions per block examined by dead store elimination

Daniel Berlin via llvm-commits llvm-commits at lists.llvm.org
Tue Aug 23 12:12:33 PDT 2016


On Tue, Aug 23, 2016 at 11:26 AM, Xinliang David Li <davidxl at google.com>
wrote:

> On Tue, Aug 23, 2016 at 9:38 AM, Philip Reames
> <listmail at philipreames.com> wrote:
> > reames added a comment.
> >
> > I just want to make sure I understand the big picture view of this
> change.  I'm going to try to summarize, please correct me if I'm wrong.
> >
> > Today, we will walk back through the list of defs/clobbers provided by
> MDA (within a single block) without limit in DSE.  Internally, MDA will
> only find defs/clobbers which are within a limited distance of each other.
> As a result, a series of adjacent clobbers will be scanned, but the same
> series of adjacent clobbers with a single long break of non-memory related
> instructions will not be.  Right?
> >
>

Let me directly answer this :)

The answer to phillip's question is "yes, you are right".


>
> See below the small example that demonstrate the issue : opt  -S -dse
> -memdep-block-scan-limit=4 < dse.ll
>
> Suppose we look at g1 = 0 store and walk backwards to look for
> dependent access. Since the scan limit is set to 4 which is a little
> higher than the distance it needs walk to find a dependent memory
> access, a valid memLoc is returned. DSE then finds out that dependent
> memory is not removable, so it will continue walk up the dep-chain
> starting from where it stopped. In other words, it essentially
> bypassed the scan limit.
>

No.
It's just a different limit.
The scan limit is maximum distance between a given starting pointer
dependency and a clobber that it will walk.



> > With the patch, we will walk backwards a fixed distance (in number of
> instructions) considering any def/clobber we see in that window.
>
> With this patch, we will remember the previous distance that we have
> walked and make sure the total distance is limited.
>

Right, but that's a different limit.
It is, as phillip says, a window.


>
> >
> > Is that a correct summary?
> >
> > (p.s. Using the same default value from the original implementation with
> the new one seems highly suspect since the old implementation would have
> been much more aggressive in practice..)
>
> This is of course tunable, but IMO, scan backward 100
> clobbering/aliased instructions in one basic block for every store
> instruction that is examined is already a pretty generous.
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160823/531163f1/attachment.html>


More information about the llvm-commits mailing list