This is the mail archive of the systemtap@sourceware.org mailing list for the systemtap project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: #SW2600


Stan Cox <scox@redhat.com> writes:

> Here is a proposed patch for the array index piece of #SW2600[..]
> optimize away assignments in other contexts).  For example: arr2[i = 1]
> = 10 can potentially become arr2[1] = 10

Great.  Two more bits: 

> @@ -1714,6 +1716,8 @@ dead_assignment_remover::visit_assignment (assignment* e)
>        *current_expr == e && // we're not nested any deeper than expected 
>        leftvar) // not unresolved $target; intended sideeffect cannot be elided
>      {
> +      e->left->visit (this);
> +      e->right->visit (this);

Should current_expr be set/reset around these calls?

> +void
> +dead_assignment_remover::visit_arrayindex (arrayindex *e)
> [...]

And a sibling function for visit_functioncall() would be nice, to
potentially elide assignments that occur within parameter lists; then
something similar with if's and while's, and maybe
unary/binary_expressions.  That should do it all.

Nice job with the test case!


- FChE


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]