[PATCH] D32980: Use the frame index side table for byval and inalloca arguments
Reid Kleckner via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon May 8 14:26:13 PDT 2017
rnk created this revision.
For inalloca functions, this is a very common code pattern:
%argpack = type <{ i32, i32, i32 }>
define void @f(%argpack* inalloca %args) {
entry:
%a = getelementptr inbounds %argpack, %argpack* %args, i32 0, i32 0
%b = getelementptr inbounds %argpack, %argpack* %args, i32 0, i32 1
%c = getelementptr inbounds %argpack, %argpack* %args, i32 0, i32 2
tail call void @llvm.dbg.declare(metadata i32* %a, ... "a")
tail call void @llvm.dbg.declare(metadata i32* %c, ... "b")
tail call void @llvm.dbg.declare(metadata i32* %b, ... "c")
Even though these GEPs can be simplified to a constant offset from EBP
or RSP, we don't do that at -O0, and each GEP is computed into a
register. Registers used to compute argument addresses are typically
spilled and clobbered very quickly after the initial computation, so
live debug variable tracking loses information very quickly if we use
DBG_VALUE instructions.
This change moves processing of dbg.declare between argument lowering
and basic block isel, so that we can ask if an argument has a frame
index or not. If the argument lives in a register as is the case for
byval arguments on some targets, then we don't put it in the side table
and during ISel we emit DBG_VALUE instructions.
https://reviews.llvm.org/D32980
Files:
llvm/lib/CodeGen/SelectionDAG/FastISel.cpp
llvm/lib/CodeGen/SelectionDAG/FunctionLoweringInfo.cpp
llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp
llvm/test/CodeGen/X86/2010-01-18-DbgValue.ll
llvm/test/CodeGen/X86/2012-11-30-handlemove-dbg.ll
llvm/test/CodeGen/X86/dbg-baseptr.ll
llvm/test/DebugInfo/X86/dbg-declare-inalloca.ll
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D32980.98208.patch
Type: text/x-patch
Size: 25670 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170508/c359363a/attachment.bin>
More information about the llvm-commits
mailing list