https://gcc.gnu.org/bugzilla/show_bug.cgi?id=58315
Alexandre Oliva <aoliva at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |ASSIGNED Assignee|aldyh at gcc dot gnu.org |aoliva at gcc dot gnu.org --- Comment #25 from Alexandre Oliva <aoliva at gcc dot gnu.org> --- Created attachment 34861 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=34861&action=edit vta-reset-inlined-vars-at-return-point.patch Mine. The debug stmts are fine, even their large quantity. In fact, we need *additional* debug stmts to fix the problem. What's causing the excess memory use is that var-tracking spends a lot of time recomputing locations for variables that have long ceased to exist, because they were inlined from other functions that have already "returned". Now, unlike local variables, that we might reasonably want to be able to access throughout the function, inlined variables are not accessible in any reasonable way once we "return" from the functions that define them. So, I introduced code to reset the binding of all inlined functions at point the call would have returned to, so that var-tracking will stop computing locations for them at that point. This brings compile time down from 2 minutes to 45 seconds (35s without -g), and it reduces the .s output by the compiler by two orders of magnitude, from 1.1G to 15M (2.6M without -g), and it shouldn't have any noticeable effect on debug information. Once regstrapping is done I'll submit it. It might have a noticeable effect in reducing the, erhm, debug info abstraction penalty in C++ programs, especially those with long functions with lots of inlined calls.