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

Alexander Potapenko via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Aug 7 08:49:58 PDT 2019


glider marked an inline comment as done.
glider added a comment.

In D65234#1615649 <https://reviews.llvm.org/D65234#1615649>, @efriedma wrote:

> For the "=x" thing I was talking about, try the following testcase:
>
>   void a() { struct S { unsigned x[4]; } z; asm volatile("%0":"=x"(z)); }
>   void a2() { struct S { unsigned x[8]; } z; asm volatile("%0":"=x"(z)); }
>
>
> clang trunk gives "error: couldn't allocate output register for constraint 'x'" in the backend for both functions.  gcc prints "%xmm0" for the first, and rejects the second; not exactly sure why it's rejecting the second, though.  It would be nice if both worked, although I guess it's okay if we print a reasonable error message.  Please add a testcase, at least.


Note that this is invalid assembly, as it emits a register name instead of an assembly instruction. I don't think it should work at all.
If we replace "%0" with a "nop", Clang will reject the second test, but will accept the first one.


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