[clang] [clang][SPARC] Treat empty structs as if it's a one-bit type in the CC (PR #90338)

Sergei Barannikov via cfe-commits cfe-commits at lists.llvm.org
Tue May 7 03:00:31 PDT 2024


================
@@ -21,6 +21,12 @@ char f_int_4(char x) { return x; }
 // CHECK-LABEL: define{{.*}} fp128 @f_ld(fp128 noundef %x)
 long double f_ld(long double x) { return x; }
 
+// Empty struct is lowered as a placeholder word parameter.
+struct empty {};
+
+// CHECK-LABEL: define{{.*}} i64 @f_empty(i64 %x.coerce)
+struct empty f_empty(struct empty x) { return x; }
+
----------------
s-barannikov wrote:

My concern is that gcc might have different rules for passing C++ classes with empty base class compared to empty C structs. Can you check that the clang C++ behavior matches gcc and possibly add a test if it is not there yet?


https://github.com/llvm/llvm-project/pull/90338


More information about the cfe-commits mailing list