Go to file
Reid Kleckner f7c0980c10 Elide argument copies during instruction selection
Summary:
Avoids tons of prologue boilerplate when arguments are passed in memory
and left in memory. This can happen in a debug build or in a release
build when an argument alloca is escaped.  This will dramatically affect
the code size of x86 debug builds, because X86 fast isel doesn't handle
arguments passed in memory at all. It only handles the x86_64 case of up
to 6 basic register parameters.

This is implemented by analyzing the entry block before ISel to identify
copy elision candidates. A copy elision candidate is an argument that is
used to fully initialize an alloca before any other possibly escaping
uses of that alloca. If an argument is a copy elision candidate, we set
a flag on the InputArg. If the the target generates loads from a fixed
stack object that matches the size and alignment requirements of the
alloca, the SelectionDAG builder will delete the stack object created
for the alloca and replace it with the fixed stack object. The load is
left behind to satisfy any remaining uses of the argument value. The
store is now dead and is therefore elided. The fixed stack object is
also marked as mutable, as it may now be modified by the user, and it
would be invalid to rematerialize the initial load from it.

Supersedes D28388

Fixes PR26328

Reviewers: chandlerc, MatzeB, qcolombet, inglorion, hans

Subscribers: igorb, llvm-commits

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

llvm-svn: 296683
2017-03-01 21:42:00 +00:00
clang clang-format: [JS] Properly format object literals with shorthands. 2017-03-01 19:47:28 +00:00
clang-tools-extra [clangd] Unbreak the shared build. 2017-03-01 16:23:40 +00:00
compiler-rt Restrict usage of MemoryMappingLayout to platforms which support it 2017-03-01 19:20:13 +00:00
debuginfo-tests New round of fixes for "Always compile debuginfo-tests for the host triple" 2014-10-18 23:47:59 +00:00
libclc math: Implement sinh function 2017-02-25 02:46:53 +00:00
libcxx [libcxx] Support threads on Fuchsia 2017-03-01 03:09:18 +00:00
libcxxabi [libcxxabi] Clean up macro usage. 2017-03-01 11:42:01 +00:00
libunwind Fix the project name in the license file. 2017-02-27 17:47:58 +00:00
lld Unbreak Windows bots. 2017-03-01 21:28:41 +00:00
lldb Add a sample_test directory with simple starter 2017-03-01 20:25:48 +00:00
llgo [llgo] Remove support for LLVM attributes 2016-12-06 19:22:04 +00:00
llvm Elide argument copies during instruction selection 2017-03-01 21:42:00 +00:00
openmp Removing couple unnecessary architecture guards. 2017-02-28 21:43:28 +00:00
parallel-libs [Axccel] Remove -Wno-missing-braces in build 2016-12-19 21:34:07 +00:00
polly [ScopInfo] Disable memory folding in case it results in multi-disjunct relations 2017-03-01 21:11:27 +00:00