This is an archive of the discontinued LLVM Phabricator instance.

[DSE] Improve handling of noop stores exposed after dead interfering stores are removed
Needs ReviewPublic

Authored by sameconrad on Jan 15 2018, 2:16 PM.

Details

Summary

This is an attempt to improve the handling of noop stores that are only exposed after the removal of interfering stores. This forces removal of noops to occur last after other deletions are complete, but should otherwise have the same semantics if the loop body exits early (ie when no def or clobbers found).

Diff Detail

Event Timeline

sameconrad created this revision.Jan 15 2018, 2:16 PM

Do you have any size/performance numbers for this? (Just trying to get a rough sense of how helpful this is.)

lib/Transforms/Scalar/DeadStoreElimination.cpp
1082

Can you reorganize this somehow so you don't use make_scope_exit()? Using RAII for control flow is tricky to follow. (If can't come up with anything better, even explicitly calling the lambda would be an improvement.)

Updated to call lambda manually, which seems like the simplest solution. Will work on some benchmark results, I don't have any offhand.

efriedma added inline comments.Jan 17 2018, 6:17 PM
lib/Transforms/Scalar/DeadStoreElimination.cpp
1091

Could you just eliminate this entire if statement? The condition is the same as the while loop's condition.

1097

I don't think EliminateNoop can actually do anything useful in this case; getLocForWrite never fails for store instructions.

Updated to remove unnecessary isDef/isClobber check, lambda is no longer necessary.

I did some benchmarking but unfortunately I couldn't find any noticeable differences in executable size from this patch. At least, nothing in test-suite seemed to result in any changes to the compiled binaries with this patch. It seems like the situation this is addressing is probably pretty rare.

mcrosier resigned from this revision.Apr 10 2018, 1:09 PM