[llvm] r359975 - [SLPVectorizer] Make getSpillCost() const. NFCI.

Simon Pilgrim via llvm-commits llvm-commits at lists.llvm.org
Sun May 5 03:37:39 PDT 2019


Author: rksimon
Date: Sun May  5 03:37:38 2019
New Revision: 359975

URL: http://llvm.org/viewvc/llvm-project?rev=359975&view=rev
Log:
[SLPVectorizer] Make getSpillCost() const. NFCI.

Ideally getTreeCost() should be const as well but non-const Type creation would need to be addressed first.

Modified:
    llvm/trunk/lib/Transforms/Vectorize/SLPVectorizer.cpp

Modified: llvm/trunk/lib/Transforms/Vectorize/SLPVectorizer.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Vectorize/SLPVectorizer.cpp?rev=359975&r1=359974&r2=359975&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/Vectorize/SLPVectorizer.cpp (original)
+++ llvm/trunk/lib/Transforms/Vectorize/SLPVectorizer.cpp Sun May  5 03:37:38 2019
@@ -524,7 +524,7 @@ public:
 
   /// \returns the cost incurred by unwanted spills and fills, caused by
   /// holding live values over call sites.
-  int getSpillCost();
+  int getSpillCost() const;
 
   /// \returns the vectorization cost of the subtree that starts at \p VL.
   /// A negative number means that this is profitable.
@@ -1305,6 +1305,13 @@ private:
     return nullptr;
   }
 
+  const TreeEntry *getTreeEntry(Value *V) const {
+    auto I = ScalarToTreeEntry.find(V);
+    if (I != ScalarToTreeEntry.end())
+      return &VectorizableTree[I->second];
+    return nullptr;
+  }
+
   /// Maps a specific scalar to its tree entry.
   SmallDenseMap<Value*, int> ScalarToTreeEntry;
 
@@ -3066,7 +3073,7 @@ bool BoUpSLP::isTreeTinyAndNotFullyVecto
   return true;
 }
 
-int BoUpSLP::getSpillCost() {
+int BoUpSLP::getSpillCost() const {
   // Walk from the bottom of the tree to the top, tracking which values are
   // live. When we see a call instruction that is not part of our tree,
   // query TTI to see if there is a cost to keeping values live over it




More information about the llvm-commits mailing list