[clang] [CIR] Mark sizeof & alignof as NYI for scalable Vector (PR #172861)

Andrzej WarzyƄski via cfe-commits cfe-commits at lists.llvm.org
Fri Dec 19 00:25:43 PST 2025


banach-space wrote:

> Before adding scalable vec, the sizeof(vec) logic was like this
> 
> return builder.getConstant(
>       loc, cir::IntAttr::get(cgf.cgm.uInt64Ty,
>                              e->EvaluateKnownConstInt(cgf.getContext())));
> Which is not correct for a scalable vector, so I added a check to mark scalable vec as NYI and add a new if block for vector type in general, and I added coverage for sizeof(vec)

So, IIUC, the implementation was updated for both types of vectors, right? As in, even for fixed vectors it was updated from:

```cpp
return builder.getConstant(
      loc, cir::IntAttr::get(cgf.cgm.uInt64Ty,
      e->EvaluateKnownConstInt(cgf.getContext())));
```
to

```cpp

return builder.getConstant(
      loc, cir::IntAttr::get(cgf.cgm.uInt64Ty,
      e->EvaluateKnownConstInt(vecTy.getSize());
```

If that's correct, it's worth updating the summary.

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


More information about the cfe-commits mailing list