https://github.com/efriedma-quic commented:
If I'm understanding correctly, the way this currently works is that you do
normal field layout, then if you discover that the actual offset of a field is
less than the offset normal field layout would produce, you assume the struct
is packed. This
efriedma-quic wrote:
I'm skeptical it's correct to skip all the assertions like this; the assertions
are there to ensure the layout of the LLVM IR type matches the layout provided
by the RecordLayout. If the LLVM IR layout is wrong, address-related
computations will be wrong, and ultimately y
efriedma-quic wrote:
> > The correct answer here is probably to fix the sizes in the RecordLayout
> > itself; in particular, the DataSize of the members.
>
> That would be ideal, but also means we'd have to reflect the various C++
> attributes that affect layout in DWARF. Avoiding adding such
efriedma-quic wrote:
Oh, in this particular case, the issue isn't the computed datasize, it's that
FieldDecl::isZeroSize() returns the wrong result. If that's the case, maybe we
can just change FieldDecl::isZeroSize() to say the field is zero size? So
essentially, we pretend all empty field
efriedma-quic wrote:
That would mean if someone wrote `struct Empty {}; struct Z { Empty a,b,c; }`,
we'd lower it to `{ [3 x i8] }` instead of `{%Empty, %Empty, %Empty}`, which is
a bit ugly. Other than that, sure, I guess we could do that.
https://github.com/llvm/llvm-project/pull/93809
efriedma-quic wrote:
> > couldn't the inverse be true, then - that codegen should ignore if
> > something isZeroSize or not?
>
> Just to clarify, is the suggestion here to remove the special handling of
> `isZeroSize` in the RecordLayoutBuilder?
We currently need to distinguish between empty
efriedma-quic wrote:
It's not that hard to compute "no-data": non-RecordDecls are never no-data,
RecordDecls are no-data if they don't have a vtable pointer (isDynamicClass()),
and all fields are no-data. We can save it in the CGRecordLayout.
Assuming that's the route we want to go, of course
@@ -0,0 +1,27 @@
+// RUN: mlir-translate -mlir-to-llvmir -split-input-file %s | FileCheck %s
+
+// Decoding the attribute does not work on big-endian platforms currently
+// XFAIL: target=s390x-{{.*}}
efriedma-quic wrote:
LLVM tests use "host-byteorder-little-end
Author: Daniel Paoliello
Date: 2023-05-16T10:58:10-07:00
New Revision: f8499d5709e37b4e9a6d2a39c385cfd2c00bad6e
URL:
https://github.com/llvm/llvm-project/commit/f8499d5709e37b4e9a6d2a39c385cfd2c00bad6e
DIFF:
https://github.com/llvm/llvm-project/commit/f8499d5709e37b4e9a6d2a39c385cfd2c00bad6e.di