[SCEV][NFC] Reduce memory footprint & compile time via DFS refactoring
authorMax Kazantsev <mkazantsev@azul.com>
Fri, 15 Oct 2021 03:19:15 +0000 (10:19 +0700)
committerMax Kazantsev <mkazantsev@azul.com>
Fri, 15 Oct 2021 03:19:15 +0000 (10:19 +0700)
commit1202d280c6d96d6ad85d7e3d9f0968a7331f4322
tree12ef6045ce9ef49f5908014695a26d932abec65e
parent44610c01aeed8402da982ab59c47f45e7b3bc93b
[SCEV][NFC] Reduce memory footprint & compile time via DFS refactoring

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.

Differential Revision: https://reviews.llvm.org/D111774
Reviewed By: nikic, reames
llvm/lib/Analysis/ScalarEvolution.cpp