[llvm] [LV] Avoid querying the cost of invalid operations (PR #89161)

Kolya Panchenko via llvm-commits llvm-commits at lists.llvm.org
Wed Apr 24 11:34:06 PDT 2024


================
@@ -7067,6 +7067,10 @@ LoopVectorizationCostModel::getInstructionCost(Instruction *I, ElementCount VF,
         SrcVecTy = smallestIntegerVectorType(SrcVecTy, MinVecTy);
         VectorTy =
             largestIntegerVectorType(ToVectorTy(I->getType(), VF), MinVecTy);
----------------
nikolaypanchenko wrote:

I do think the logic here is wrong: we do truncation from largest to smallest, so computation of `SrcVecTy` and `VectorTy` should be swapped.
Looks like so far this code was "lucky" as non-RISC-V TTI tolerates such discrepancy between src and dst types.

https://github.com/llvm/llvm-project/pull/89161


More information about the llvm-commits mailing list