[llvm-commits] [PATCH] Attempt to DSE non-local stores

Török Edwin edwintorok at gmail.com
Wed Jun 17 11:46:23 PDT 2009


Hi,

I realised that DSE wasn't actually deleting stores that were really
dead (no loads/stores from pointer), but only deleted redundant stores (
when there was a second load/store from same pointer).

DeadStoreElimination also has a comment :// FIXME: cross-block DSE would
be fun. :)

The attached patch is a small, incremental improvement:
- it handles single non-local dependencies the same as local deps
- it handles the case where an instruction only has a fake dep (first
inst in BB)

On the attached bitcode DSE is able to eliminate 3 stores, that LLVM is
currently not eliminating at -O3.

Before thinking about more complex non-local DSE, I am sending out this
patch for review.

In particular can I rely on MemDep returning a single fake dependency
when there are no instructions
accessing that pointer (or alias thereof) in the entire function?

Would it make sense to improve MemDep to return 2 new kind of dependencies:
- nonFunctionLocal: there is no instruction/call in the current function
that can possibly access the pointer (or alias thereof), except the
instruction
being queried
- Dead/None:  as nonFunctionLocal, but removing the instruction being
queried doesn't change the behaviour of the function, i.e.
the pointer doesn't alias any of the function's arguments, or globals

Best regards,
--Edwin


-------------- next part --------------
A non-text attachment was scrubbed...
Name: dse.patch
Type: text/x-diff
Size: 2428 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20090617/b700456f/attachment.patch>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: x.bc
Type: application/octet-stream
Size: 3272 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20090617/b700456f/attachment.obj>


More information about the llvm-commits mailing list