[PATCH] D28388: Add ArgumentCopyElision MI pass
Reid Kleckner via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Jan 5 17:25:00 PST 2017
rnk created this revision.
rnk added reviewers: chandlerc, MatzeB, qcolombet, inglorion, hans.
rnk added a subscriber: llvm-commits.
Herald added a subscriber: mgorny.
LLVM frequently copies arguments from the stack when generating
unoptimized code or when an argument's address is taken. This pass
identifies stores of loads of argument stack slots in the entry block,
deletes the store, and replaces all uses of the frame index with the
original load's frame index.
It is currently disabled by default under the flag
-enable-arg-copy-elim.
In a 32-bit release build of Chrome, this saves 20K from both
chrome_child.dll and chrome.dll. Each DLL is about 50MB, so this is less
than 0.05% for each, so it's not what I'd hoped, but it's simple enough
to keep. In the future, this pass could be extended to handle aggregates
that have been split into multiple LLVM arguments in clang.
The potential wins in a debug build are much greater because all
arguments will live in memory, but I think we should do this whole thing
in fast isel instead. First, x86 fast isel needs to know how to lower
arguments in memory. When we do that, it should be easy to add the
IR-equivalent pattern matching to identify allocas that are immediately
initialized by arguments passed in memory and use the appropriate
argument frame index from the beginning of ISel.
Fixes PR26328
https://reviews.llvm.org/D28388
Files:
include/llvm/CodeGen/MachineFrameInfo.h
include/llvm/CodeGen/Passes.h
include/llvm/InitializePasses.h
lib/CodeGen/ArgumentCopyElision.cpp
lib/CodeGen/CMakeLists.txt
lib/CodeGen/TargetPassConfig.cpp
test/CodeGen/X86/argument-copy-elision.ll
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D28388.83329.patch
Type: text/x-patch
Size: 14530 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170106/9b9d8661/attachment.bin>
More information about the llvm-commits
mailing list