llvm-beanz wrote:

> Is this the expected behaviour:
> 
> ```c++
> struct EmptyPadding : Empty { Empty e; int X; };
> struct Repeated : Empty, DerivedEmpty { int X; }; // expected-warning 
> {{inaccessible due to ambiguity}}
> _Static_assert(sizeof(EmptyPadding) == 8, "");
> _Static_assert(sizeof(Repeated) == 8, "");
> _Static_assert(sizeof(NotEmpty) == 4, "");
> _Static_assert(__is_scalarized_layout_compatible(EmptyPadding, NotEmpty), "");
> _Static_assert(__is_scalarized_layout_compatible(Repeated, NotEmpty), "");
> ```
> 
> I.e., is the "scalarization" expected to get rid of padding? A similar issue 
> happens with padding introduced by over-alignment.

Yes, the scalarized layout ignores padding. Because HLSL generally assumes that 
structures become fully scalarized with elements stored in registers we have 
way laxer requirements around structure layout for "local" memory.

> Also see [#98310 
> (comment)](https://github.com/llvm/llvm-project/issues/98310#issuecomment-2248326726):
>  This should be renamed to `__builtin_is_scalarized_layout_compatible` to be 
> consistent with new type traits.

Will do!


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

Reply via email to