This is an archive of the discontinued LLVM Phabricator instance.

[SCEV][NFC] Reduce memory footprint & compile time via DFS refactoring
ClosedPublic

Authored by mkazantsev on Oct 13 2021, 9:42 PM.

Details

Summary

Current implementations of DFS in SCEV check unique-visited of traversed
values on pop, and not on push. As result, the same value may be pushed
multiple times just to be thrown away when popped. These operations are
meaningless and only waste time and increase memory footprint of the
worklist.

This patch reworks the DFS strategy to check uniqueness before push.
Should be NFC.

Diff Detail

Event Timeline

mkazantsev created this revision.Oct 13 2021, 9:42 PM
mkazantsev requested review of this revision.Oct 13 2021, 9:42 PM
Herald added a project: Restricted Project. · View Herald TranscriptOct 13 2021, 9:42 PM

Nikita, could you please check if there's any visible impact from this?

mkazantsev edited the summary of this revision. (Show Details)Oct 13 2021, 9:46 PM
nikic accepted this revision.Oct 14 2021, 11:39 AM

LGTM. I don't see any practical impact, but this still makes sense to me.

This revision is now accepted and ready to land.Oct 14 2021, 11:39 AM

LGTM by me as well. Thanks for doing this, the resulting code is much more idiomatic and readable.