[PATCH] D111533: [SCEV] Invalidate user SCEVs along with operand SCEVs to avoid cache corruption

Nikita Popov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Oct 27 14:59:32 PDT 2021


nikic added inline comments.


================
Comment at: llvm/lib/Analysis/ScalarEvolution.cpp:12877
           if (any_of(ToForget,
                      [&BEInfo](const SCEV *S) { return BEInfo.hasOperand(S); }))
             Map.erase(I++);
----------------
nikic wrote:
> Hm ... we don't really need to consider user SCEVs here, as the used SCEV will be part of the operands as well.
> 
> Alternatively, if we're already considering user SCEVs, we no longer need the hasOperand() approach, we could directly check whether `ENT.ExactNotTaken == S`.
To finish the thought, we could do something like `for (const auto &EI : BEInfo.ExitNotTaken) if (ToForget.contains(EI.ExactNotTaken)) erase()`, which makes this approximately O(exits) rather than O(loops * scevs). In any case, that's for a followup...


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

https://reviews.llvm.org/D111533



More information about the llvm-commits mailing list