[PATCH] D98512: [LoopVectorize] Simplify scalar cost calculation in getInstructionCost
Sander de Smalen via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Mar 24 02:15:13 PDT 2021
sdesmalen added inline comments.
================
Comment at: llvm/lib/Transforms/Vectorize/LoopVectorize.cpp:7242
+#ifndef NDEBUG
+bool LoopVectorizationCostModel::hasSingleCopyAfterVectorization(
----------------
I'd prefer to either remove the ifndef here so that it's always defined (and the compiler can optimize it away if it isn't called), or implementing the lambda suggestion from Florian.
================
Comment at: llvm/lib/Transforms/Vectorize/LoopVectorize.cpp:7557
// is unknown. Assume that it is the same as 'mul'.
- return VF.getKnownMinValue() * TTI.getArithmeticInstrCost(
- Instruction::Mul, VectorTy, CostKind) +
+ return VF.getFixedValue() * TTI.getArithmeticInstrCost(Instruction::Mul,
+ VectorTy, CostKind) +
----------------
This should probably return `TTI.getArithmeticInstrCost(..)` now, because the VF.getFixedValue() multiplier and possible scalarization overhead are now represented as part of `VectorTy` and the call to `TTI.getArithmeticInstrCost`. There be no reason why this default opcode should behave differently from the other opcodes now that you've done the work to verify the right type is passed to the `TTI.get`*Cost calls.
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D98512/new/
https://reviews.llvm.org/D98512
More information about the llvm-commits
mailing list