[PATCH] D110390: [SCEV] Establish control over disposition caches

Max Kazantsev via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Sep 24 01:35:23 PDT 2021


mkazantsev created this revision.
mkazantsev added reviewers: reames, nikic, lebedev.ri, fhahn.
Herald added subscribers: asbirlea, javed.absar, hiraditya.
mkazantsev requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

SCEV's loop and block disposition caches are a mess. Loop disposition has
a public method to be called to external users when it may break, but for
some reason is not called from forgetLoop. Block disposition does not even
have API for this. So it may be (and actually is) broken.

It should not be a responsibility of transform passes to know what caches SCEV
has or how they work. It's enough that have API to `forgetLoop` and `forgetValue`
that allow to signal that something might have changed.

In this patch, we regain full control of SCEV over its disposition caches. Accessor
methods are moved to private API and are now called from `forgetLoop` and
`forgetValue`. It might be tad more conservative than needed, but it's a lesser evil
compared to the broken state we now have.

It may have a negative compile time impact. Though, it shouldn't really be a problem:
typically passes tend to make all queries first and only then do the IR changes, so we
should at least enjoy full power of caching while querying.


https://reviews.llvm.org/D110390

Files:
  llvm/include/llvm/Analysis/ScalarEvolution.h
  llvm/lib/Analysis/ScalarEvolution.cpp
  llvm/lib/Transforms/Scalar/LICM.cpp
  llvm/lib/Transforms/Scalar/LoopDeletion.cpp
  llvm/lib/Transforms/Scalar/LoopSink.cpp
  llvm/lib/Transforms/Utils/LoopSimplify.cpp
  llvm/test/Transforms/LCSSA/pr44058.ll
  llvm/test/Transforms/LCSSA/pr44320.ll
  llvm/test/Transforms/LoopFusion/triple_loop_nest_inner_guard.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D110390.374749.patch
Type: text/x-patch
Size: 6084 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210924/47b02220/attachment.bin>


More information about the llvm-commits mailing list