llvm-project/llvm/lib/CodeGen/AsmPrinter
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
..
ARMException.cpp PR 31534: When emitting both DWARF unwind tables and debug information, 2017-01-05 20:55:28 +00:00
AddressPool.cpp Move helpers into anonymous namespaces. NFC. 2016-08-06 11:13:10 +00:00
AddressPool.h One more batch of self-containing headers. 2016-01-27 19:29:56 +00:00
AsmPrinter.cpp OptDiag: Summarize the instruction count in asm-printer 2017-02-24 00:19:22 +00:00
AsmPrinterDwarf.cpp Reapply "[CodeGen] Fix invalid DWARF info on Win64" 2017-01-02 03:00:19 +00:00
AsmPrinterHandler.h Extract the method to begin and end a fragment in AsmPrinterHandler in their own method. NFC 2016-02-26 20:30:37 +00:00
AsmPrinterInlineAsm.cpp [Assembler] Improve diagnostics for inline assembly. 2017-02-13 13:58:00 +00:00
ByteStreamer.h [NFC] Header cleanup 2016-04-18 09:17:29 +00:00
CMakeLists.txt [CMake] NFC. Updating CMake dependency specifications 2016-11-17 04:36:50 +00:00
CodeViewDebug.cpp [PDB] Make streams carry their own endianness. 2017-02-28 00:04:07 +00:00
CodeViewDebug.h Refactor DebugHandlerBase a bit to common non-debug-having-function filtering 2017-02-16 18:48:33 +00:00
DIE.cpp [DebugInfo] Rename EmitDebugValue to EmitDebugThreadLocal (NFC) 2017-02-08 19:03:46 +00:00
DIEHash.cpp Make a DWARF generator so we can unit test DWARF APIs with gtest. 2016-12-08 01:03:48 +00:00
DIEHash.h Apply another batch of fixes from clang-tidy's performance-unnecessary-value-param. 2016-06-17 20:41:14 +00:00
DbgValueHistoryCalculator.cpp CodeGen: Give MachineBasicBlock::reverse_iterator a handle to the current MI 2016-09-11 18:51:28 +00:00
DbgValueHistoryCalculator.h One more batch of self-containing headers. 2016-01-27 19:29:56 +00:00
DebugHandlerBase.cpp Refactor DebugHandlerBase a bit to common non-debug-having-function filtering 2017-02-16 18:48:33 +00:00
DebugHandlerBase.h Refactor DebugHandlerBase a bit to common non-debug-having-function filtering 2017-02-16 18:48:33 +00:00
DebugLocEntry.h Use print() instead of dump() in code 2017-01-28 06:53:55 +00:00
DebugLocStream.cpp
DebugLocStream.h
DwarfAccelTable.cpp This change removes the dependency on DwarfDebug that was used for DW_FORM_ref_addr by making a new DIEUnit class in DIE.cpp. 2016-12-01 18:56:29 +00:00
DwarfAccelTable.h Remove LLVM_CONSTEXPR. 2016-10-23 19:39:16 +00:00
DwarfCFIException.cpp PR 31534: When emitting both DWARF unwind tables and debug information, 2017-01-05 20:55:28 +00:00
DwarfCompileUnit.cpp Add missing module/license header. NFC. 2017-03-01 00:14:42 +00:00
DwarfCompileUnit.h DebugInfo: ensure type and namespace names are included in pubnames/pubtypes even when they are only present in type units 2017-02-03 00:44:18 +00:00
DwarfDebug.cpp Debug Info: Sort frame index expressions before emitting them. 2017-02-17 19:42:32 +00:00
DwarfDebug.h Elide argument copies during instruction selection 2017-03-01 21:42:00 +00:00
DwarfException.h Emit .cfi_sections before the first .cfi_startproc 2017-01-02 18:05:27 +00:00
DwarfExpression.cpp DebugInfo: remove unused parameter from function. NFC. 2017-01-25 20:58:07 +00:00
DwarfExpression.h DebugInfo: remove unused parameter from function. NFC. 2017-01-25 20:58:07 +00:00
DwarfFile.cpp Make a DWARF generator so we can unit test DWARF APIs with gtest. 2016-12-08 01:03:48 +00:00
DwarfFile.h Make a DWARF generator so we can unit test DWARF APIs with gtest. 2016-12-08 01:03:48 +00:00
DwarfStringPool.cpp
DwarfStringPool.h
DwarfUnit.cpp Alphabetize some cases (NFC) 2017-03-01 19:01:47 +00:00
DwarfUnit.h [DWARFv5] Emit new unit header format. 2017-02-28 20:24:55 +00:00
EHStreamer.cpp Move most EH from MachineModuleInfo to MachineFunction 2016-12-01 19:32:15 +00:00
EHStreamer.h Extract the method to begin and end a fragment in AsmPrinterHandler in their own method. NFC 2016-02-26 20:30:37 +00:00
ErlangGCPrinter.cpp [MC] Fix some Clang-tidy modernize and Include What You Use warnings; other minor fixes (NFC). 2017-02-14 00:33:36 +00:00
LLVMBuild.txt Prune unused libdeps. 2016-12-08 15:28:02 +00:00
OcamlGCPrinter.cpp Use the range variant of find instead of unpacking begin/end 2016-08-11 22:21:41 +00:00
WinException.cpp [WinEH] Don't assume endFunction is called while in .text 2016-12-28 19:05:12 +00:00
WinException.h [WinEH] Don't assume endFunction is called while in .text 2016-12-28 19:05:12 +00:00