diff --git a/llvm/include/llvm/CodeGen/BasicTTIImpl.h b/llvm/include/llvm/CodeGen/BasicTTIImpl.h --- a/llvm/include/llvm/CodeGen/BasicTTIImpl.h +++ b/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(DataTy)) + return InstructionCost::getInvalid(); + auto *VT = cast(DataTy); // Assume the target does not have support for gather/scatter operations // and provide a rough estimate.