[PATCH] D49225: [SLPVectorizer] Move scalar/vector costs to helper functions (NFCI).

Simon Pilgrim via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jul 16 13:28:12 PDT 2018


RKSimon added inline comments.


================
Comment at: lib/Transforms/Vectorize/SLPVectorizer.cpp:609-610
 
+  /// \returns the cost of the scalar instruction \p I.
+  int getScalarCost(Instruction *I, Type *DstSclTy);
+
----------------
ABataev wrote:
> Can we just use `TTI->getInstructionCost(I, TargetTransformInfo::TCK_RecipThroughput);` instead of this function?
I've kept more closely to the original code than might be necessary - more of the instructions could use TTI->getInstructionCost directly in the switch statements - but enums like GEP and Cast have minor diffs that we seem to be relying on....


================
Comment at: lib/Transforms/Vectorize/SLPVectorizer.cpp:612-615
+  /// \returns the cost of a vectorized version of the scalar instruction \p I.
+  int getVectorCost(Instruction *I, ArrayRef<Value *> VL, Type *DstSclTy,
+                    VectorType *DstVecTy);
+
----------------
ABataev wrote:
> The same question here
Again, there are some diffs in the calls but we might be able to reuse more than we do - the TTI->getInstructionCost isn't really designed to take a scalar Instruction and a vector Type.


Repository:
  rL LLVM

https://reviews.llvm.org/D49225





More information about the llvm-commits mailing list