diff options
author | Florian Hahn <flo@fhahn.com> | 2020-10-30 13:48:28 +0000 |
---|---|---|
committer | Florian Hahn <flo@fhahn.com> | 2020-10-30 13:49:08 +0000 |
commit | 73f01e3df58dca9d1596440b866b52929e3878de (patch) | |
tree | 660fa936eeac21098bfeb67c3725aaeb8b075a8b /llvm/lib/Transforms/Utils/ScalarEvolutionExpander.cpp | |
parent | ec809e4cfe0be08b1bab7ba7e6ff905b9430571a (diff) | |
download | llvm-73f01e3df58dca9d1596440b866b52929e3878de.zip llvm-73f01e3df58dca9d1596440b866b52929e3878de.tar.gz llvm-73f01e3df58dca9d1596440b866b52929e3878de.tar.bz2 |
[TTI] Add VecPred argument to getCmpSelInstrCost.
On some targets, like AArch64, vector selects can be efficiently lowered
if the vector condition is a compare with a supported predicate.
This patch adds a new argument to getCmpSelInstrCost, to indicate the
predicate of the feeding select condition. Note that it is not
sufficient to use the context instruction when querying the cost of a
vector select starting from a scalar one, because the condition of the
vector select could be composed of compares with different predicates.
This change greatly improves modeling the costs of certain
compare/select patterns on AArch64.
I am also planning on putting up patches to make use of the new argument in
SLPVectorizer & LV.
Reviewed By: dmgreen, RKSimon
Differential Revision: https://reviews.llvm.org/D90070
Diffstat (limited to 'llvm/lib/Transforms/Utils/ScalarEvolutionExpander.cpp')
-rw-r--r-- | llvm/lib/Transforms/Utils/ScalarEvolutionExpander.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/llvm/lib/Transforms/Utils/ScalarEvolutionExpander.cpp b/llvm/lib/Transforms/Utils/ScalarEvolutionExpander.cpp index c4d90a4..a45b5cd 100644 --- a/llvm/lib/Transforms/Utils/ScalarEvolutionExpander.cpp +++ b/llvm/lib/Transforms/Utils/ScalarEvolutionExpander.cpp @@ -2236,9 +2236,9 @@ template<typename T> static int costAndCollectOperands( unsigned MinIdx, unsigned MaxIdx) { Operations.emplace_back(Opcode, MinIdx, MaxIdx); Type *OpType = S->getOperand(0)->getType(); - return NumRequired * - TTI.getCmpSelInstrCost(Opcode, OpType, - CmpInst::makeCmpResultType(OpType), CostKind); + return NumRequired * TTI.getCmpSelInstrCost( + Opcode, OpType, CmpInst::makeCmpResultType(OpType), + CmpInst::BAD_ICMP_PREDICATE, CostKind); }; switch (S->getSCEVType()) { |