[clang] [mlir] [llvm] [llvm][TypeSize] Consider TypeSize of '0' to be fixed/scalable-agnostic. (PR #72994)

Michael Maitland via cfe-commits cfe-commits at lists.llvm.org
Tue Nov 21 07:09:40 PST 2023


michaelmaitland wrote:

> TypeSize::Scalable(0) + TypeSize::Fixed(4) == TypeSize::Fixed(4)

>From the [docs](https://llvm.org/docs/LangRef.html#t-vector)
> The number of elements is a constant integer value larger than 0; elementtype may be any integer, floating-point or pointer type. Vectors of size zero are not allowed. For scalable vectors, the total number of elements is a constant multiple (called vscale) of the specified number of elements; vscale is a positive integer that is unknown at compile time and the same hardware-dependent constant for all scalable vectors at run time. The size of a specific scalable vector type is thus constant within IR, even if the exact size in bytes cannot be determined until run time.

Creating a scalable vector of size 0 should not even be allowed.

https://github.com/llvm/llvm-project/pull/72994


More information about the cfe-commits mailing list