[llvm] [LV] Fix incorrect cost kind in VPReplicateRecipe::computeCost (PR #153216)
Florian Hahn via llvm-commits
llvm-commits at lists.llvm.org
Thu Aug 14 04:43:57 PDT 2025
fhahn wrote:
> > Thanks. Would be great to have a test case for this. I can check if I can surface anything
>
> I don't think this is even possible at the moment, because this will currently only apply if you build with `-Oz -fvectorize`, but you can't even write a test case for this because we hit the error at the end of `LoopVectorizationCostModel::computeMaxVF`:
>
> ```
> reportVectorizationFailure(
> "Cannot optimize for size and vectorize at the same time.",
> ```
>
> I suppose that really means this patch is NFC and should be harmless. I just wanted to change the CostKind for completeness.
Hm, I think we should definitely hit VPReplicateRecipe::computeCost with different CostKinds, e.g. for this test https://github.com/llvm/llvm-project/blob/main/llvm/test/Transforms/LoopVectorize/AArch64/optsize_minsize.ll#L221
For Os/Oz, the requirement is that there is no scalar tail + no runtime checks IIRC, and the message is for that case.
https://github.com/llvm/llvm-project/pull/153216
More information about the llvm-commits
mailing list