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

Xinliang David Li via llvm-commits llvm-commits at lists.llvm.org
Tue Aug 23 12:34:58 PDT 2016


On Tue, Aug 23, 2016 at 12:12 PM, Daniel Berlin <dberlin at dberlin.org> wrote:
>
>
> 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.
>

yes, they are different -- but the original limit is not quite useful.

David


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


More information about the llvm-commits mailing list