This bug was found by recent improvement in SCEV verifier. The code in LoopFuse
directly reassigns blocks to be a part of a different loop, which should automatically
invalidate all related cached loop dispositions.
Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
Keeping drop of these loop dispositions as a separate call generally looks increasingly annoying... I'll see if there is a way to get rid of it.
Hmm, would it make sense to forget loop dispositions as part of forgetLoop? Having to clean them up separately is very easy to forget and also not really clear from the existing documentation.
I'd be fine with that, but depends on CT. Let's extinguish fire and try to measure it.
forgetLoop() already clears loop dispositions for values it forgets -- but these are only the values based on loop header phis, so an explicit forgetLoopDispositions() is needed if the disposition of other values changes.
We can't easily clear all dispositions for a loop because of how these maps are indexed -- we can either efficiently clear dispositions for a SCEV or for a Loop, but not both at the same time. This is a recurring problem in SCEV, I wonder if it has some elegant solution. (We basically need a multi-key map where each key part can be efficiently invalidated.)
But we could have a second parallel index, and whenever we cache SCEV-> loop also remember loop->SCEV mapping in other place. Doesn't really sound too complex.