[PATCH] D13363: [DeadStoreElimination] Add support for non-local DSE

Ivan Baev via llvm-commits llvm-commits at lists.llvm.org
Thu Nov 12 21:09:48 PST 2015


> On Wed, Nov 4, 2015 at 6:53 PM, Ivan Baev via llvm-commits <
> llvm-commits at lists.llvm.org> wrote:
>
>> ivanbaev marked 3 inline comments as done.
>> ivanbaev added a comment.
>>
>> Hi Bruno, the patch has been rebased, and should apply cleanly on ToT.
>>
>> Mitch, thanks for your comments and suggestions.
>> Non-local DSE extension follows the structure of HandleFree(). The
>> underlying analysis for DSE is MD, and for across-BB both - HandleFree
>> and
>> HandleNonLocalDependency - use MD->getPointerDependencyFrom(). Note that
>> MD
>> is not loop-aware
>
>
> What do you mean by this, precisely?
>
>
> Given a store and load in the loop like this:
>
> for (int i = 0; i < 50; ++i)
>  {
>
> load *b
> store *b
> }
>
> MD will definitely give you the store as a dependency of the load.
>

Yes, MD will give us that the store is dependent on the load for the
example above.

Consider the following extended example.
------------------------------
for (int i = 0; i < 50; ++i)
{
 x = load *b
 ...
 y = x + 1
 ...
 store y, *b
}
store *b
------------------------------

MD->getPointerDependencyFrom(Loc=b, loopBB->end(), "store *b") will
return def dependency on the store within the loop. However, a non-local DSE
should not remove that store, because y might have other uses, in addition
to the one in "store y, *b"

Ivan










More information about the llvm-commits mailing list