[patch] PR15662: reordered function parameters when inlining
David Blaikie
dblaikie at gmail.com
Tue Jun 4 16:36:59 PDT 2013
This fixes PR15662 as follows:
PR15662: Optimized debug info produces out of order function parameters
When a function is inlined we lazily construct the variables
representing the function's parameters. After that, we add any remaining
unused parameters.
If the function doesn't use all the parameters, or uses them out of
order, then the DWARF would produce them in that order, producing a
parameter order that doesn't match the source.
This fix causes us to always keep the arg variables at the start of the
variable list & in the original order from the source.
The only issue is that this slows down slightly the non-opt case (we'd
bail out when we find the variables list attached to the subprogram is
empty) & moreso in the opt case (since we have to do the
search/ordering work). We could do a bit more to make the loop at
DwarfDebug.cpp:1679 be more efficient (rather than calling
addScopeVariable each time causing a new search for the insertion
point, we could factor it out to find/use the insertion point
incrementally). I also didn't actually try to find a test case where
variables were used in the inline function, but out of order. If such
a case doesn't exist, then there would be no need to handle insertion
order in the lazy/inlining case - just at the "put the rest in" at the
end (the aforementioned loop). As it is, we could still make the lazy
case better by continuing to be lazy, then re-ordering them just once
at the end.
Open to suggestions/preferences/ideas.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: pr15662.diff
Type: application/octet-stream
Size: 6842 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20130604/fa5b85cc/attachment.obj>
More information about the llvm-commits
mailing list