[Clang] Consider updating `getMinimumObjectSize` to not return 0 bytes for SVE types
- Dominant language
- LLVM
- Stars
- 40.5k
- Forks
- 18.7k
- PR merge metrics
- PR metrics pending
Description
https://github.com/llvm/llvm-project/blob/1cc730fd7b31cdc240a6357b66e7a1b05bbfe135/clang/lib/CodeGen/CodeGenModule.h#L1208-L1213
It seems like when we call this function with an SVE vector type, such as `svfloat32x2_t`, it returns 0. I think this is because it ultimately calls `getTypeSizeInChars()`, and that [will return 0](https://github.com/llvm/llvm-project/blob/1cc730fd7b31cdc240a6357b66e7a1b05bbfe135/clang/lib/AST/ASTContext.cpp#L2392) as the length is only known at runtime. However, if I'm reading [the documentation](https://support.arm.com/documentation/102476/0101/Introducing-SVE) correctly, I think the minimum size has to be 16 bytes.
Noticed during code review of https://github.com/llvm/llvm-project/pull/213347#discussion_r3699373368.
Contributor guide
Research direction
Read getMinimumObjectSize in clang/lib/CodeGen/CodeGenModule.h and trace its call to getTypeSizeInChars in clang/lib/AST/ASTContext.cpp. Reproduce the behavior with an SVE type such as svfloat32x2_t and confirm that the minimum object size is reported as 16 bytes rather than 0.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- compilers
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 52/100