[PATCH] D40480: MemorySSA backed Dead Store Elimination.

Florian Hahn via llvm-commits llvm-commits at lists.llvm.org
Sun Dec 8 07:07:17 PST 2019


Hi,

> On Dec 6, 2019, at 22:19, Bryant Wong <llvm-commits at xorshift.org> wrote:
> 
> > I'd also like to lift the post-domination requirement for cases where we can prove that an overriding store on all paths to the exit/other reads.
> 
> Could you provide an example of what this means? It's unclear to me.
> 

The motivating example would be something like the following below. S1 is dead (assuming the condition does not ready x and does not throw), but neither s2 or s3 post-dominate it. If we can prove that on both paths we have stores to x, then we should be able to eliminate s1, unless I miss something. IIUC MemorySSA makes those split points explicit via MemoryPHIs, so it should be possible to detect such cases.

*x = 0; (s1)
If (…)
  *x = 10; (s2)
else
  *x = 20; (s3)

Cheers,
Florian


More information about the llvm-commits mailing list