This is an archive of the discontinued LLVM Phabricator instance.

[Sema][SVE] Fix handling of initialisers for built-in SVE types
ClosedPublic

Authored by rsandifo-arm on Mar 24 2020, 4:50 AM.

Details

Summary

The built-in SVE types are supposed to be treated as opaque types.
This means that for initialisation purposes they should be treated
as a single unit, much like a scalar type.

However, as Eli pointed out, actually using "scalar" in the diagnostics
is likely to cause confusion, given the types are logically vectors.
The patch therefore uses custom diagnostics or generalises existing
ones. Some of the messages use the word "indivisible" to try to make
it clear(er) that these types can't be initialised elementwise.

I don't think it's possible to trigger warn_braces_around_(scalar_)init
for sizeless types as things stand, since the types can't be used as
members or elements of more complex types. But it seemed better to be
consistent with ext_many_braces_around_(scalar_)init, so the patch
changes it anyway.

Diff Detail

Event Timeline

rsandifo-arm created this revision.Mar 24 2020, 4:50 AM
Herald added a project: Restricted Project. · View Herald Transcript

Semantically, this makes sense.

I'm not really happy with the use of the term "scalar initializer" to refer to initializing a vector. Seems likely to confuse users.

Don't refer to the sizeless types as "scalars"

Also add more tests.

Semantically, this makes sense.

I'm not really happy with the use of the term "scalar initializer" to refer to initializing a vector. Seems likely to confuse users.

Yeah, fair point :-) I've tried to use more appropriate wording in the update.

efriedma accepted this revision.May 1 2020, 6:30 PM

LGTM

This revision is now accepted and ready to land.May 1 2020, 6:30 PM
This revision was automatically updated to reflect the committed changes.