[ScopHelper] Cache ScopExpander results.
The number of SCEV expressions is usually linear in the number of IR instructions being modeled. However, a naive SCEV visitor is not. For an expression like x*x, "x" will be visited twice. If x is itself an expression like x*x, that will be visited twice, etc, and the overall runtime is O(2^N) in the number of SCEV expressions. To prevent this from happening, add a cache, so we only visit each SCEV expression once. Not sure this is the best solution. Maybe we can instead check whether the SCEV is scop-invariant (in which case we never need to map the value). But we don't have a utility for that at the moment. Differential Revision: https://reviews.llvm.org/D47087 llvm-svn: 335783
Loading
Please register or sign in to comment