------- Comment #13 from jakub at gcc dot gnu dot org 2010-03-17 15:05 ------- Created an attachment (id=20130) --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=20130&action=view) gcc45-pr43058.patch
So far untested fix. This just optimizes handling of optimized out variables which are known to be constant (in some part of the code or whole function). We don't need to change the location list every time the constant value is assigned to some register or memory. That's unlike vars that actually live in some register or memory at some point, there of course we want to have the location for the register/memory so that the debugger can change it. The testcase keeps pushing .LC0 resp. LC1 into some register (or MEM slot) and then every call actually clobbers that reg resp. MEM slot, so after every set of the reg resp. mem var-tracking was generating up to 1000 var_location notes for every a decl with that value, then in the middle of every call another up to 1000 var_location notes that the var now is constant and doesn't live in the reg or mem. While it is IMHO desirable to do what this patch does in any case, I'll try to come up with another solution which would try to keep the location list less fragmented. -- jakub at gcc dot gnu dot org changed: What |Removed |Added ---------------------------------------------------------------------------- AssignedTo|unassigned at gcc dot gnu |jakub at gcc dot gnu dot org |dot org | Status|NEW |ASSIGNED http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43058