[CodeGen]: don't treat structures returned in registers as memory inputs
authorAlexander Potapenko <glider@google.com>
Thu, 29 Aug 2019 11:21:41 +0000 (11:21 +0000)
committerAlexander Potapenko <glider@google.com>
Thu, 29 Aug 2019 11:21:41 +0000 (11:21 +0000)
commit1b5e38a6c9108d933965e1b706364890ac24b8ba
tree9983680392bd07e85692694fac8c2013cd080b68
parentca0e4b3689648ea23bfb408ffb6744283e5a6d66
[CodeGen]: don't treat structures returned in registers as memory inputs

Summary:
The "=r" output constraint for a structure variable passed to inline asm
shouldn't be converted to "=*r", as this changes the asm directive
semantics and prevents DSE optimizations.
Instead, preserve the constraints and return such structures as integers
of corresponding size, which are converted back to structures when
storing the result.

Fixes PR42672.

Subscribers: cfe-commits

Tags: #clang

Differential Revision: https://reviews.llvm.org/D65234

llvm-svn: 370335
clang/lib/CodeGen/CGStmt.cpp
clang/test/CodeGen/asm-attrs.c
clang/test/CodeGen/x86_64-PR42672.c [new file with mode: 0644]