[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 13:12:04 PDT 2021


nikic added a comment.

In D111533#3089254 <https://reviews.llvm.org/D111533#3089254>, @mkazantsev wrote:

> Upon that, I'm going to merge it tomorrow if there will be no objections.

Yeah, feel free. I didn't have time to work on this and don't want to hold it up further.



================
Comment at: llvm/lib/Analysis/ScalarEvolution.cpp:12849
   SmallPtrSet<const SCEV *, 8> ToForget(SCEVs.begin(), SCEVs.end());
+  SmallVector<const SCEV *, 8> Worklist(SCEVs.begin(), SCEVs.end());
+
----------------
Might make sense to initialize this from `ToForget` to avoid duplicates in the initial worklist?


================
Comment at: llvm/lib/Analysis/ScalarEvolution.cpp:12877
           if (any_of(ToForget,
                      [&BEInfo](const SCEV *S) { return BEInfo.hasOperand(S); }))
             Map.erase(I++);
----------------
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`.


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

https://reviews.llvm.org/D111533



More information about the llvm-commits mailing list