[PATCH] D66255: [WebAssembly] Correctly handle va_arg of zero-sized structures

Derek Schuff via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Aug 14 14:26:30 PDT 2019


dschuff added inline comments.


================
Comment at: clang/test/CodeGen/wasm-varargs.c:104
+
+struct S test_zero_size_struct(char *fmt, ...) {
+  va_list va;
----------------
This should maybe be called "test_empty_struct" since its size is actually 1 and not zero.


================
Comment at: clang/test/CodeGen/wasm-varargs.c:115
+
+// CHECK: define void @test_zero_size_struct([[STRUCT_S:%[^,=]+]]*{{.*}} noalias sret [[AGG_RESULT:%.*]], i8*{{.*}} %fmt, ...) {{.*}} {
+// CHECK:   [[FMT_ADDR:%[^,=]+]] = alloca i8*, align 4
----------------
could use CHECK_LABEL here and above.


================
Comment at: clang/test/CodeGen/wasm-varargs.c:125
+// CHECK:   store i8* [[ARGP_NEXT]], i8** [[VA]], align 4
+// CHECK:   [[R0:%[^,=]+]] = bitcast i8* [[ARGP_CUR]] to [[STRUCT_Z]]*
+// CHECK:   [[R1:%[^,=]+]] = bitcast [[STRUCT_Z]]* [[U]] to i8*
----------------
It looks like most of the output (up to here) is boilerplate for va_arg setup and duplicates the CHECKs above. It might be more clear if we just omitted the duplicated stuff and only CHECK for the things that are different from the above test.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D66255/new/

https://reviews.llvm.org/D66255





More information about the cfe-commits mailing list