]> granicus.if.org Git - llvm/commitdiff
[SCEV] Make PendingLoopPredicates more frugal; NFCI
authorSanjoy Das <sanjoy@playingwithpointers.com>
Tue, 27 Sep 2016 18:01:38 +0000 (18:01 +0000)
committerSanjoy Das <sanjoy@playingwithpointers.com>
Tue, 27 Sep 2016 18:01:38 +0000 (18:01 +0000)
I don't expect `PendingLoopPredicates` to have very many
elements (e.g. when -O3'ing the sqlite3 amalgamation,
`PendingLoopPredicates` has at most 3 elements).  So now we use a
`SmallPtrSet` for it instead of the more heavyweight `DenseSet`.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@282511 91177308-0d34-0410-b5e6-96231b3b80d8

include/llvm/Analysis/ScalarEvolution.h
lib/Analysis/ScalarEvolution.cpp

index 8249d70d1f5933ec77fd22c5a91122a4da957cc9..47671c8e346481d26d8fab23f0fe9050c719c589 100644 (file)
@@ -533,7 +533,7 @@ private:
   ValueExprMapType ValueExprMap;
 
   /// Mark predicate values currently being processed by isImpliedCond.
-  DenseSet<Value *> PendingLoopPredicates;
+  SmallPtrSet<Value *, 6> PendingLoopPredicates;
 
   /// Set to true by isLoopBackedgeGuardedByCond when we're walking the set of
   /// conditions dominating the backedge of a loop.
index c46464c6a2504824441c4e8a989ae16dcdcb0349..038204e88391f270efb01ab9a135f4e6fe53a039 100644 (file)
@@ -8064,11 +8064,11 @@ namespace {
 /// currently evaluating isImpliedCond.
 struct MarkPendingLoopPredicate {
   Value *Cond;
-  DenseSet<Value*> &LoopPreds;
+  SmallPtrSetImpl<Value *> &LoopPreds;
   bool Pending;
 
-  MarkPendingLoopPredicate(Value *C, DenseSet<Value*> &LP)
-    : Cond(C), LoopPreds(LP) {
+  MarkPendingLoopPredicate(Value *C, SmallPtrSetImpl<Value *> &LP)
+      : Cond(C), LoopPreds(LP) {
     Pending = !LoopPreds.insert(Cond).second;
   }
   ~MarkPendingLoopPredicate() {
@@ -9577,6 +9577,7 @@ ScalarEvolution::ScalarEvolution(ScalarEvolution &&Arg)
     : F(Arg.F), HasGuards(Arg.HasGuards), TLI(Arg.TLI), AC(Arg.AC), DT(Arg.DT),
       LI(Arg.LI), CouldNotCompute(std::move(Arg.CouldNotCompute)),
       ValueExprMap(std::move(Arg.ValueExprMap)),
+      PendingLoopPredicates(std::move(Arg.PendingLoopPredicates)),
       WalkingBEDominatingConds(false), ProvingSplitPredicate(false),
       BackedgeTakenCounts(std::move(Arg.BackedgeTakenCounts)),
       PredicatedBackedgeTakenCounts(