This is an archive of the discontinued LLVM Phabricator instance.

[DSE,MSSA] Remove dead stores to stack-allocated locations
AbandonedPublic

Authored by Whitney on Jun 23 2020, 1:57 PM.

Details

Summary

This patch adds the support to remove dead stores to stack-allocated locations when -enable-dse-memoryssa=true.
For example:

%A = alloca i32
...
store i32 1, i32* %A
ret void

Note that dead stores to stack-allocated locations in end blocks can already be removed when -enable-dse-memoryssa=false.

Diff Detail

Event Timeline

Whitney created this revision.Jun 23 2020, 1:57 PM
fhahn added a comment.Jun 23 2020, 3:56 PM

Thanks for working on this. I think a patch I've been working on for a while solves the same problem, but in a slightly more general way I think: D72631.

There's one more slightly larger outstanding patch to support 'memory terminators' like lifetime.end/free as well: D72410. I think those patches should get us to almost cover all cases legacy DSE does, but there is plenty of potential for further improvements. I would be more than happy to sync up to avoid duplicating work, if you are also interested in working on MemorySSA backed DSE :)

Whitney abandoned this revision.EditedJun 23 2020, 4:33 PM

Thanks for working on this. I think a patch I've been working on for a while solves the same problem, but in a slightly more general way I think: D72631.

There's one more slightly larger outstanding patch to support 'memory terminators' like lifetime.end/free as well: D72410. I think those patches should get us to almost cover all cases legacy DSE does, but there is plenty of potential for further improvements. I would be more than happy to sync up to avoid duplicating work, if you are also interested in working on MemorySSA backed DSE :)

@fhahn Cool, cancelled this revision. Positive side is I understand better of how MemorySSA backed DSE works after working on this patch :)
Do you know if there are plans on eliminating dead stores to array (in a loop)?