[llvm] [LV] fix logical error in trunc cost (PR #91136)
Florian Hahn via llvm-commits
llvm-commits at lists.llvm.org
Thu May 16 03:22:00 PDT 2024
================
@@ -7123,16 +7117,15 @@ LoopVectorizationCostModel::getInstructionCost(Instruction *I, ElementCount VF,
// "zext i8 %1 to i32" becomes "zext i8 %1 to i16".
//
// Calculate the modified src and dest types.
- Type *MinVecTy = VectorTy;
if (Opcode == Instruction::Trunc) {
- SrcVecTy = smallestIntegerVectorType(SrcVecTy, MinVecTy);
+ SrcVecTy = smallestIntegerVectorType(SrcVecTy, VectorTy);
VectorTy =
- largestIntegerVectorType(ToVectorTy(I->getType(), VF), MinVecTy);
+ smallestIntegerVectorType(ToVectorTy(I->getType(), VF), VectorTy);
----------------
fhahn wrote:
Is this now a no-op as `VectorTy` should also use `I`'s return type?
Also looking at the code above, is it actually computing the narrowed types anywhere?
Is this missing something like the below?
```
RetTy = IntegerType::get(RetTy->getContext(), MinBWs[I]);
```
https://github.com/llvm/llvm-project/pull/91136
More information about the llvm-commits
mailing list