#SW2600
Frank Ch. Eigler
fche@redhat.com
Fri May 16 18:00:00 GMT 2008
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
More information about the Systemtap
mailing list