[PATCH] D65234: [CodeGen]: don't treat structures returned in registers as memory inputs

Eli Friedman via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Jul 26 11:48:15 PDT 2019


efriedma added inline comments.


================
Comment at: clang/test/CodeGen/PR42672.c:50
+  struct {
+    long long int v1, v2, v3, v4;
+  } str;
----------------
glider wrote:
> The acceptable size actually depends on the target platform. Not sure we can test for all of them, and we'll probably need to restrict this test to e.g. x86
The interesting case for a 32-byte struct would actually be something like `"=x"(str)`... which currently passes the clang frontend, since 32 is a legal size for that constraint (although it eventually fails in the backend).


================
Comment at: clang/test/CodeGen/PR42672.c:3
+// RUN: %clang_cc1 -USTRUCT -emit-llvm %s -o - | FileCheck %s --check-prefix=CHECK-NOSTRUCT
+// RUN: %clang_cc1 -triple=x86_64-unknown-linux-gnu -DIMPOSSIBLE -emit-llvm %s -o - 2> %t || true
+// RUN: grep "impossible constraint in asm" %t
----------------
Might as well just make all these tests use an x86 triple; I don't really want to speculate how an unknown target will react to any specific size.


================
Comment at: clang/test/CodeGen/PR42672.c:40
+    unsigned short first;
+    unsigned char second;
+  } str;
----------------
This isn't a three-byte struct; it's a four-byte struct where one of the bytes is only used for padding. 


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D65234





More information about the cfe-commits mailing list