[PATCH] D119529: [BasicTTI] Set scalarization cost of getCommonMaskedMemoryOpCost to Invalid.
Liao Chunyu via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Mar 31 18:57:24 PDT 2022
liaolucy added a comment.
Herald added a project: All.
> This function assumes fixed-width vectors and cannot be used for scalable vectors. I'm not sure what returning 'Invalid' here would really fix, other than the compiler not crashing for a use-case that should not have occurred in the first place, because an overloaded cost function should have been implemented. Whether the compiler falls into the assert from `cast<FixedVectorType>`, or whether it returns an Invalid cost, in either case you'll need to implement a memory-op-cost function for your target. And because you'll need to implement a cost-function anyway, returning Invalid doesn't really make a difference, because then this code will never be hit. Otherwise, you would have been able to write a test-case for it.
Many salable vectors use this function and crash . Maybe D121677 <https://reviews.llvm.org/D121677> is a test-case. GetMaskedMemoryOpCost and getGatherScatterOpCost only return getCommonMaskedMemoryOpCost , so each scalable vector call to these functions will crash. However, getMaskedMemoryOpCost and getGatherScatterOpCost can be implemented by each target, not implemented will it crashes. There seems to be a problem.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D119529/new/
https://reviews.llvm.org/D119529
More information about the llvm-commits
mailing list