[PATCH] D40429: [SCEV][NFC] More efficient caching in CompareValueComplexity

Max Kazantsev via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Nov 28 00:27:22 PST 2017


This revision was automatically updated to reflect the committed changes.
Closed by commit rL319153: [SCEV][NFC] More efficient caching in CompareValueComplexity (authored by mkazantsev).

Changed prior to commit:
  https://reviews.llvm.org/D40429?vs=124346&id=124525#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D40429

Files:
  llvm/trunk/lib/Analysis/ScalarEvolution.cpp


Index: llvm/trunk/lib/Analysis/ScalarEvolution.cpp
===================================================================
--- llvm/trunk/lib/Analysis/ScalarEvolution.cpp
+++ llvm/trunk/lib/Analysis/ScalarEvolution.cpp
@@ -549,10 +549,10 @@
 /// Since we do not continue running this routine on expression trees once we
 /// have seen unequal values, there is no need to track them in the cache.
 static int
-CompareValueComplexity(SmallSet<std::pair<Value *, Value *>, 8> &EqCache,
+CompareValueComplexity(EquivalenceClasses<Value *> &EqCache,
                        const LoopInfo *const LI, Value *LV, Value *RV,
                        unsigned Depth) {
-  if (Depth > MaxValueCompareDepth || EqCache.count({LV, RV}))
+  if (Depth > MaxValueCompareDepth || EqCache.isEquivalent(LV, RV))
     return 0;
 
   // Order pointer values after integer values. This helps SCEVExpander form
@@ -619,7 +619,7 @@
     }
   }
 
-  EqCache.insert({LV, RV});
+  EqCache.unionSets(LV, RV);
   return 0;
 }
 
@@ -649,7 +649,7 @@
     const SCEVUnknown *LU = cast<SCEVUnknown>(LHS);
     const SCEVUnknown *RU = cast<SCEVUnknown>(RHS);
 
-    SmallSet<std::pair<Value *, Value *>, 8> EqCache;
+    EquivalenceClasses<Value *> EqCache;
     int X = CompareValueComplexity(EqCache, LI, LU->getValue(), RU->getValue(),
                                    Depth + 1);
     if (X == 0)


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D40429.124525.patch
Type: text/x-patch
Size: 1365 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20171128/e1a504dc/attachment.bin>


More information about the llvm-commits mailing list