diff options
author | Roman Lebedev <lebedev.ri@gmail.com> | 2023-01-22 17:27:17 +0300 |
---|---|---|
committer | Roman Lebedev <lebedev.ri@gmail.com> | 2023-01-22 17:48:49 +0300 |
commit | 3c560dd0ae676e28a2560b1041c9411908e999a5 (patch) | |
tree | dad0e80ed11b86c4db6c2230a560e794bc2c9251 /llvm/lib/Transforms/Utils/ScalarEvolutionExpander.cpp | |
parent | 418f780f1f882dbe4f72fcbd3b24b2ce34520557 (diff) | |
download | llvm-3c560dd0ae676e28a2560b1041c9411908e999a5.zip llvm-3c560dd0ae676e28a2560b1041c9411908e999a5.tar.gz llvm-3c560dd0ae676e28a2560b1041c9411908e999a5.tar.bz2 |
[NFC][SCEVExpander] `CmpSelCost`: use the cost of the expression, not operand
Currently, for all invocations, it's equivalent, since that is literally
how `SCEVMinMaxExpr::getType()` is defined. But for e.g. `select`,
we'll want to ask about the hand type, and not the type of the operand
that happens to be first.
Diffstat (limited to 'llvm/lib/Transforms/Utils/ScalarEvolutionExpander.cpp')
-rw-r--r-- | llvm/lib/Transforms/Utils/ScalarEvolutionExpander.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/llvm/lib/Transforms/Utils/ScalarEvolutionExpander.cpp b/llvm/lib/Transforms/Utils/ScalarEvolutionExpander.cpp index 5a0292a..24f1966 100644 --- a/llvm/lib/Transforms/Utils/ScalarEvolutionExpander.cpp +++ b/llvm/lib/Transforms/Utils/ScalarEvolutionExpander.cpp @@ -2113,7 +2113,7 @@ template<typename T> static InstructionCost costAndCollectOperands( auto CmpSelCost = [&](unsigned Opcode, unsigned NumRequired, unsigned MinIdx, unsigned MaxIdx) -> InstructionCost { Operations.emplace_back(Opcode, MinIdx, MaxIdx); - Type *OpType = S->getOperand(0)->getType(); + Type *OpType = S->getType(); return NumRequired * TTI.getCmpSelInstrCost( Opcode, OpType, CmpInst::makeCmpResultType(OpType), CmpInst::BAD_ICMP_PREDICATE, CostKind); |