http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54779
Bug #: 54779 Summary: split FRAME variables back into pieces Classification: Unclassified Product: gcc Version: 4.8.0 Status: UNCONFIRMED Severity: enhancement Priority: P3 Component: middle-end AssignedTo: unassig...@gcc.gnu.org ReportedBy: ebotca...@gcc.gnu.org CC: jamb...@gcc.gnu.org Created attachment 28323 --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=28323 Original implementation When nested functions access local variables of their parent, the compiler creates a special FRAME local variable in the parent, which represents the non-local frame, and puts into it all the variables accessed non-locally. If these nested functions are later inlined into their parent, these FRAME variables generally remain unmodified and this has various drawbacks: 1) the frame of the parent is unnecessarily large, 2) scalarization of aggregates put into the FRAME variables is hindered, 3) debug info for scalars put into the FRAME variables is poor since VTA only works on GIMPLE registers. The attached patch makes it so that the compiler splits FRAME variables back into pieces when all the nested functions have been inlined. The transformation is implemented as a sub-pass of execute_update_addresses_taken. It also comes with a testcase. Prerequisite is revision 191970. * gimple.c (gimple_ior_addresses_taken_1): Handle non-local frame structures specially. * tree-ssa.c (lookup_decl_for_field): New static function. (split_nonlocal_frames_op): Likewise. (execute_update_addresses_taken): Break up non-local frame structures into variables when possible.