sdesmalen-arm wrote:

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

Correct, but that is no reason to disallow a value of '0' for TypeSize. This is 
just a class to represent a value (fixed or scalable), and it's up to the 
places where TypeSize is used on whether that use is valid. You could argue the 
same for an `int`, which is used to represent the size of a type.

FWIW, one of the uses for a zero-sized TypeSize value (and also the motivating 
reason for this patch) is e.g. to get the combined size of spills for N 
vectors, you could do:
```
TypeSize Size();
for (auto Obj : Objects)
  Size += Obj.getSize();
```
without having to determine before the loop whether Size needs to be Fixed or 
Scalable.

https://github.com/llvm/llvm-project/pull/72994
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to