This is an archive of the discontinued LLVM Phabricator instance.

[NFC][IR] Replace isa<ScalableVectorType> with a predicator function.
AbandonedPublic

Authored by HsiangKai on Mar 7 2021, 9:34 PM.

Details

Summary

Instead of checking whether if the type is ScalableVectorType, define a
predicate function for scalable types. It will be easier for us to extend
the meaning of 'scalable types'. For example, if we want to support scalable
vectors within a struct in the future, the type will be StructType, not
ScalableVectorType, but it is still a scalable type.

Diff Detail

Event Timeline

HsiangKai created this revision.Mar 7 2021, 9:34 PM
HsiangKai requested review of this revision.Mar 7 2021, 9:34 PM
Herald added a project: Restricted Project. · View Herald TranscriptMar 7 2021, 9:34 PM

I guess the question here is whether a "scalable type" is the same as a "scalable vector type". I can imagine that we might want something more specific to vectors in many cases, e.g. "isScalableVectorType", whereas "isScalableType" could potentially apply to more than just vectors.

lebedev.ri requested changes to this revision.Mar 8 2021, 12:24 AM
lebedev.ri added a subscriber: lebedev.ri.

I'm not convinced this is correct.
For example, shufflevector only works on vectors, so i don't see why a "struct with scalable vector" is even relevant there.

This revision now requires changes to proceed.Mar 8 2021, 12:24 AM

I'm not convinced this is correct.
For example, shufflevector only works on vectors, so i don't see why a "struct with scalable vector" is even relevant there.

I think it is checking isScalableType is some cases and checking isScalableVectorType in other cases. I will separate them.

HsiangKai updated this revision to Diff 329132.Mar 8 2021, 1:52 PM

Separate the checking into isScalableVectorType() and isScalableType().

What does isScalableVectorType() provide over the previous isa<ScalableVectorType>? Especially since it still appears next to cast<FixedVectorType>

What does isScalableVectorType() provide over the previous isa<ScalableVectorType>? Especially since it still appears next to cast<FixedVectorType>

It seems only has one possibility for isScalableVectorType(). I will revert these cases.

HsiangKai updated this revision to Diff 329190.Mar 8 2021, 6:58 PM

Remove redundant predicator functions.

I'm not sure what this improves.

HsiangKai abandoned this revision.Jun 2 2021, 7:45 AM