[PATCH] D35931: [SCEV] Do not visit nodes twice in containsConstantSomewhere

Max Kazantsev via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jul 27 00:00:46 PDT 2017


mkazantsev created this revision.

The function containsConstantSomewhere naively traverses the expression tree by DFS,
not bothering to check if it has already visited a node. As result, it spends a lot of time
processing corner cases where SCEVs contain huge powers of some expressions.

This patch prevents containsConstantSomewhere  from adding each element into the
stack more than once.


https://reviews.llvm.org/D35931

Files:
  lib/Analysis/ScalarEvolution.cpp
  test/Transforms/LoopSimplify/pr33494.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D35931.108419.patch
Type: text/x-patch
Size: 4392 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170727/05e01450/attachment.bin>


More information about the llvm-commits mailing list