llvm/lib
Reid Kleckner 4c3428b604 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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@296683 91177308-0d34-0410-b5e6-96231b3b80d8
2017-03-01 21:42:00 +00:00
..
Analysis Revert r296575 "[SLP] Fixes the bug due to absence of in order uses of scalars which needs to be available" 2017-03-01 18:57:16 +00:00
AsmParser Change debug-info-for-profiling from a TargetOption to a function attribute. 2017-02-01 22:45:09 +00:00
Bitcode Move symbols from the global namespace into (anonymous) namespaces. NFC. 2017-02-11 11:06:55 +00:00
CodeGen Elide argument copies during instruction selection 2017-03-01 21:42:00 +00:00
DebugInfo [DWARF] Print leading zeros in type signature 2017-03-01 19:43:29 +00:00
Demangle Add support for demangling C++11 thread_local variables. 2017-01-31 15:56:36 +00:00
ExecutionEngine [Orc] Rename ObjectLinkingLayer -> RTDyldObjectLinkingLayer. 2017-02-20 05:45:14 +00:00
Fuzzer [libFuzzer] remove usage of the old coverage instrumentation 2017-02-28 23:23:48 +00:00
IR Keep attributes, calling convention, etc, when remangling intrinsic 2017-03-01 01:49:13 +00:00
IRReader Timer: Track name and description. 2016-11-18 19:43:18 +00:00
LibDriver LibDriver: Allow resource files to be archive members. 2016-12-15 19:37:46 +00:00
LineEditor
Linker IRMover: Merge flags LinkModuleInlineAsm and IsPerformingImport. 2017-02-03 17:01:14 +00:00
LTO [LTO] Add ability to emit assembly to new LTO API 2017-02-15 20:36:36 +00:00
MC [DWARFv5] llvm-mc support for new unit header. 2017-02-28 23:40:46 +00:00
Object Actually add error handling to unpacking the dyld compact bind and 2017-02-28 21:47:07 +00:00
ObjectYAML Move symbols from the global namespace into (anonymous) namespaces. NFC. 2017-02-11 11:06:55 +00:00
Option Cleanup dump() functions. 2017-01-28 02:02:38 +00:00
Passes Add call branch annotation for ICP promoted direct call in SamplePGO mode. 2017-02-23 22:15:18 +00:00
ProfileData [PGO] Fix a bug in reading text format value profile. 2017-02-27 21:42:39 +00:00
Support [APInt] Optimize APInt creation from uint64_t 2017-03-01 21:06:18 +00:00
TableGen Use print() instead of dump() in code 2017-01-28 02:47:46 +00:00
Target Elide argument copies during instruction selection 2017-03-01 21:42:00 +00:00
Transforms NewGVN: Add debug counter for value numbering 2017-03-01 19:59:26 +00:00
XRay [XRAY] [x86_64] Adding a Flight Data filetype reader to the llvm-xray Trace implementation. 2017-02-17 01:47:16 +00:00
CMakeLists.txt [XRay] Define the library for XRay trace logs 2017-01-11 06:39:09 +00:00
LLVMBuild.txt Add an c++ itanium demangler to llvm. 2016-09-06 19:16:48 +00:00