This is an archive of the discontinued LLVM Phabricator instance.

[llvm][Codegen] Make `getVectorTypeBreakdownMVT` work with scalable types.
ClosedPublic

Authored by fpetrogalli on Apr 3 2020, 3:16 PM.

Diff Detail

Event Timeline

fpetrogalli created this revision.Apr 3 2020, 3:16 PM
Herald added a project: Restricted Project. · View Herald TranscriptApr 3 2020, 3:16 PM
efriedma added inline comments.Apr 3 2020, 4:12 PM
llvm/lib/CodeGen/TargetLoweringBase.cpp
954

I'd prefer just making people write out isPowerOf2_32(EC.Min). This sort of operation should be rare, and I'd prefer to spell out what it actually means.

968

I'm not sure how you expect this assertion to work out. For the current set of defined MVTs, it might work for SVE, but this will explode as soon as someone adds MVTs for a new target, or tries to add support for a target that doesn't have f16 vectors, or we query this on a target that doesn't support scalable vectors.

There's also the larger problem of how legalization should work if we run into a scalable vector with an illegal element type. Not sure what the right answer is there.

978–979

At this point, the element count is known to be a power of two; maybe it would be simpler to work with the element types here? Those are never scalable, so it's more obvious that NextPowerOf2 does something sane.

fpetrogalli marked 2 inline comments as done.

Thank you for the review @efriedma.

I have updated the patch accordingly.

Francesco

fpetrogalli marked 2 inline comments as done.Apr 8 2020, 8:18 AM
This revision is now accepted and ready to land.Apr 8 2020, 11:40 AM
This revision was automatically updated to reflect the committed changes.