[Analysis] Ensure getTypeLegalizationCost returns a simple VT for TypeScalarizeScalab...
authorDavid Sherwood <david.sherwood@arm.com>
Fri, 12 Nov 2021 16:19:56 +0000 (16:19 +0000)
committerDavid Sherwood <david.sherwood@arm.com>
Wed, 17 Nov 2021 13:11:58 +0000 (13:11 +0000)
commit8d77555b1234a2620238125328160dbe88a5e487
tree41c9b4a55a0dfa444a1b1c7cd8c50f8deccfbf6f
parentaeedbd39a34deed30ca80acfa64ee2d8d1716c78
[Analysis] Ensure getTypeLegalizationCost returns a simple VT for TypeScalarizeScalableVector

When getTypeConversion returns TypeScalarizeScalableVector we were
sometimes returning a non-simple type from getTypeLegalizationCost.
However, many callers depend upon this being a simple type and will
crash if not. This patch changes getTypeLegalizationCost to ensure
that we always a return sensible simple VT. If the vector type
contains unusual integer types, e.g. <vscale x 2 x i3>, then we just
set the type to MVT::i64 as a reasonable default.

A test has been added here that demonstrates the vectoriser can
correctly calculate the cost of vectorising a "zext i3 to i64"
instruction with a VF=vscale x 1:

  Transforms/LoopVectorize/AArch64/sve-inductions-unusual-types.ll

Differential Revision: https://reviews.llvm.org/D113777
llvm/lib/CodeGen/TargetLoweringBase.cpp
llvm/test/Transforms/LoopVectorize/AArch64/sve-inductions-unusual-types.ll