[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
Thu Jul 25 13:41:53 PDT 2019


efriedma added inline comments.


================
Comment at: clang/lib/CodeGen/CGStmt.cpp:2287
   assert(RegResults.size() == ResultRegDests.size());
+  assert(ResultTypeRequiresCast.size() <= ResultRegDests.size());
   for (unsigned i = 0, e = RegResults.size(); i != e; ++i) {
----------------
Not "=="?


================
Comment at: clang/lib/CodeGen/CGStmt.cpp:2325
+      Dest = MakeAddrLValue(
+          A, getContext().getIntTypeForBitwidth(Size, /*Signed*/ false));
+    }
----------------
Will this work if the struct is an unusual size, like `sizeof(struct s) == 3` or `sizeof(struct s) == 32`?  (3 is unlikely to show up in real code, but 32 could correspond to a vector register.)


================
Comment at: clang/test/CodeGen/PR42672.c:2
+// RUN: %clang_cc1 -DSTRUCT -O2 -emit-llvm %s -o - | FileCheck %s
+// RUN: %clang_cc1 -USTRUCT -O2 -emit-llvm %s -o - | FileCheck %s
+//
----------------
We usually try to avoid tests that run "-O2"; it's simpler to just check the unoptimized clang output directly.


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