[PATCH] D119529: [BasicTTI] Set scalarization cost of getCommonMaskedMemoryOpCost to Invalid.

Jim Lin via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Feb 11 01:18:25 PST 2022


Jim created this revision.
Jim requested review of this revision.
Herald added subscribers: llvm-commits, alextsao1999.
Herald added a project: LLVM.

This fixes crashing on `auto *VT = cast<FixedVectorType>(DataTy);` when
the type is a scalable vector.

Fix https://github.com/llvm/llvm-project/issues/53599.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D119529

Files:
  llvm/include/llvm/CodeGen/BasicTTIImpl.h


Index: llvm/include/llvm/CodeGen/BasicTTIImpl.h
===================================================================
--- llvm/include/llvm/CodeGen/BasicTTIImpl.h
+++ llvm/include/llvm/CodeGen/BasicTTIImpl.h
@@ -195,6 +195,10 @@
                                               bool VariableMask,
                                               bool IsGatherScatter,
                                               TTI::TargetCostKind CostKind) {
+    // Cost for scalable type is Invalid, can't assume any num elements.
+    if (isa<ScalableVectorType>(DataTy))
+      return InstructionCost::getInvalid();
+
     auto *VT = cast<FixedVectorType>(DataTy);
     // Assume the target does not have support for gather/scatter operations
     // and provide a rough estimate.


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D119529.407805.patch
Type: text/x-patch
Size: 767 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220211/70a70493/attachment.bin>


More information about the llvm-commits mailing list