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

Alexey Bataev via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jul 17 06:30:15 PDT 2018


ABataev added a comment.

In https://reviews.llvm.org/D49225#1164807, @RKSimon wrote:

> I think the use of TTI->getInstructionCost in getScalarCost would be quite straightforward - it is getVectorCost that will need most of the custom handling as we're manipulating scalar Instructions to query equivalent vector costs.
>
> IMO we're better off using the getScalarCost/getVectorCost abstractions instead of embedding TTI->getInstructionCost calls directly inside BoUpSLP::getEntryCost - it notably helps simplify the code and improves readability.


I tried to do something similar some time ago, but I did not like it. Instead of one switch for opcode we have 2. But we already know the opcode in many cases and, actually, the second switch is required only for the shuffles. Maybe it is worth it to outline several standalone functions for PHIs, CmpInsts, BinOps etc. and use them directly where we know the opcode and use these getScalarCost/getVectorCost only for shuffles? Of course, these 2 functions also should call these outlined cost functions for each particular opcode.


Repository:
  rL LLVM

https://reviews.llvm.org/D49225





More information about the llvm-commits mailing list