This is an archive of the discontinued LLVM Phabricator instance.

[Analysis] Ensure getTypeLegalizationCost returns a simple VT for TypeScalarizeScalableVector
ClosedPublic

Authored by david-arm on Nov 12 2021, 8:31 AM.

Details

Summary

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

Diff Detail