This is an archive of the discontinued LLVM Phabricator instance.

[DAGCombine] Skip PostInc combine with later users
ClosedPublic

Authored by samparker on Mar 9 2020, 6:40 AM.

Details

Summary

When decided whether to generate a post-inc load/store, look at the other memory nodes that use the same base address and, if any proceed the current node, then don't do the combine.
The change only seems to be affecting the Arm backend, which I was surprised at, but it appears to fix a lot of our issues around MVE masked load/stores having to store a temporary address after an early post-increment on a shared base address.

Diff Detail

Event Timeline

samparker created this revision.Mar 9 2020, 6:40 AM
dmgreen added inline comments.Mar 10 2020, 3:05 AM
llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
14189

Should we also be checking that this Use can use some addressing mode and fold the offset in? Not that it just is a memory operation?

14192

Do we need to store LaterMemOps or can we just set TryNext to true?

samparker marked an inline comment as done.Mar 12 2020, 2:42 AM
samparker added inline comments.
llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
14189

Yeah, I shouldn't have been lazy.

samparker updated this revision to Diff 250785.Mar 17 2020, 8:17 AM
samparker edited the summary of this revision. (Show Details)

Rebased and exit if a later post-inc/dec use is found.

dmgreen accepted this revision.Mar 22 2020, 2:47 PM

Looks nice.

This revision is now accepted and ready to land.Mar 22 2020, 2:47 PM
This revision was automatically updated to reflect the committed changes.