You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In [libstdc++ std::variant
implementation](https://github.com/gcc-mirror/gcc/blob/b0419798447ae25de2f58d1a695db6dadb5d8547/libstdc%2B%2B-v3/include/std/variant#L387-L394),
union without any fields is used.
According to current CodeGen logic, append 1 byte padding for this kind
of union.
Handle this union in `mlir::RecordType` for getLargestMember` return
nullptr also.
The original LLVM IR
```llvm
%union.EmptyUnion = type { i8 }
@__const._Z2f0v.e = private unnamed_addr constant %union.EmptyUnion undef, align 1
define dso_local void @_Z2f0v() #0 {
entry:
%e = alloca %union.EmptyUnion, align 1
call void @llvm.memcpy.p0.p0.i64(ptr align 1 %e, ptr align 1 @__const._Z2f0v.e, i64 1, i1 false)
ret void
}
```
The CIR lowered LLVM IR
```llvm
%union.EmptyUnion = type { i8 }
define dso_local void @_Z2f0v() #0 {
%1 = alloca %union.EmptyUnion, i64 1, align 1
store %union.EmptyUnion undef, ptr %1, align 1
ret void
}
```
The major different is original use global const and memcpy, the current
use store. The difference between the two is not related to this
revision.
0 commit comments