================
@@ -152,31 +152,88 @@ void CIRDialect::printType(Type type, DialectAsmPrinter
&os) const {
// Shared helpers for StructType and UnionType parse/print.
-/// Parse "incomplete" or "{type, type, ...}", writing results into
-/// \p incomplete and \p members. Returns failure if member parsing fails.
+llvm::ArrayRef<RecordMemberKind>
+cir::normalizeRecordMemberKinds(llvm::ArrayRef<RecordMemberKind> memberKinds) {
----------------
adams381 wrote:
Consider this example:
```c
struct S { char c; int i; char d; };
_Atomic struct S a;
```
Compiled with -fclangir -emit-cir emits:
```
!rec_S = !cir.struct<"S" {!s8i, !s32i, !s8i}>
!rec_anon_struct = !cir.struct<{!rec_S, !cir.array<!s8i x 4>}>
```
When the parser reads `!rec_anon_struct` it sees no `empty` nor `pad` marks on
either member and marks them `data` and we get `[data, data]`.
There is code in the compiler (a caller) that builds that same type.
CIRGenTypes calls `StructType::get` for the `_Atomic` wrapper and doesn't pass
the optional `member_kinds` parameter. Because the parameter defaults to empty
we get no list.
In order to have the uniqueness test report that the two are the same type, we
need to normalize them.
https://github.com/llvm/llvm-project/pull/215174
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits