This is an archive of the discontinued LLVM Phabricator instance.

[BasicTTI] Set scalarization cost of scalable vector casts to Invalid.
ClosedPublic

Authored by sdesmalen on Jul 23 2021, 5:50 AM.

Details

Summary

When BasicTTIImpl::getCastInstrCost can't determine the cost of a
vector cast operation when the types need legalization, it falls
back to calculating scalarization costs. Instead of crashing on
cast<FixedVectorType>(DstVTy) when the type is a scalable vector,
return an Invalid cost.

Diff Detail

Event Timeline

sdesmalen requested review of this revision.Jul 23 2021, 5:50 AM
sdesmalen created this revision.
Herald added a project: Restricted Project. · View Herald TranscriptJul 23 2021, 5:50 AM
david-arm added inline comments.Jul 23 2021, 6:39 AM
llvm/test/Analysis/CostModel/AArch64/sve-fptoi.ll
20

It seems a little inconsistent that we return a cost of one for converting <vscale x 1 x double>, whereas it's invalid for <vscale x 1 x float>. Not sure if we need to worry about this?

sdesmalen added inline comments.Jul 23 2021, 6:57 AM
llvm/test/Analysis/CostModel/AArch64/sve-fptoi.ll
20

Yes, it's inconsistent, but I don't think it's really something to worry about now. For all legal types or too-wide types (that require splitting) we should have sensible costs, whereas VFs with vscale x 1 types are currently avoided for SVE.

david-arm accepted this revision.Jul 23 2021, 7:03 AM

LGTM! Happy to revisit the inconsistency another time.

This revision is now accepted and ready to land.Jul 23 2021, 7:03 AM
This revision was landed with ongoing or failed builds.Jul 24 2021, 6:14 AM
This revision was automatically updated to reflect the committed changes.