[PATCH] D94654: [SCEV] Do not cache comparison result upon reached max depth as "equivalence". PR48725

Max Kazantsev via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jan 27 04:30:55 PST 2021


mkazantsev planned changes to this revision.
mkazantsev added inline comments.


================
Comment at: llvm/lib/Analysis/ScalarEvolution.cpp:860
     const SCEV *&LHS = Ops[0], *&RHS = Ops[1];
     if (CompareSCEVComplexity(EqCacheSCEV, EqCacheValue, LI, RHS, LHS, DT) < 0)
       std::swap(LHS, RHS);
----------------
aqjune wrote:
> I see that the definition of Optional::operator< is as follows:
> ```
> template <typename T>
> constexpr bool operator<(const Optional<T> &X, const T &Y) {
>   return !X || *X < Y;
> }
> ```
> So, this will hold if CompareSCEVComplexity returns None as well. Is this okay?
Good point! Actually it's not. Thanks for catching this.


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

https://reviews.llvm.org/D94654



More information about the llvm-commits mailing list