[PATCH] D111602: [SCEV][NFC] Tackle quadratic CT consumption when forgetting memoized results

Max Kazantsev via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Oct 13 21:10:44 PDT 2021


mkazantsev added inline comments.


================
Comment at: llvm/lib/Analysis/ScalarEvolution.cpp:7497
       // count for loop0 and getBackedgeTakenInfo(loop0) will clear out the trip
       // count for loop1, effectively nullifying SCEV's trip count cache.
       for (auto *U : I->users())
----------------
mkazantsev wrote:
> nikic wrote:
> > Just wondering, does the problem described in this comment affect the new invalidation mechanism?
> If I'm reading this correctly, the new mechanism will drop trip count cache. The notion that we can sometimes forget something not for correctness purposes, but for the sole purpose of getting better results, is interesting. If it doesn't lead to any dangling pointers or directly wrong cached results, maybe we should consider non-recursive invalidation here.
> 
Giving it some more thought, I think this one might be a source of bugs. Imagine that exit count depends on a hypothetical SCEV (not corresponding to any existing instruction directly) which, in turn, uses value being forgotten. When it is destroyed, how do we ensure that we'll not end up with exit count referencing (indirectly) a dangling pointer?


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D111602/new/

https://reviews.llvm.org/D111602



More information about the llvm-commits mailing list