next up previous contents
Next: 5.4.4 Control Optimization Up: 5.4 Source Optimization Previous: 5.4.2 Constant Folding

5.4.3 Unused Expression Elimination

   

If the value of any expression is not used, and the expression has no side-effects, then it is deleted. As with constant folding, this optimization applies most often when cleaning up after inline expansion and other optimizations. Any function declared an extensions:constant-function is also subject to unused expression elimination.

Note that Python will eliminate parts of unused expressions known to be side-effect free, even if there are other unknown parts. For example:

(let ((a (list (foo) (bar))))
  (if t
      (zow)
      (raz a)))
becomes:
(progn (foo) (bar))
(zow)


Raymond Toy
Mon Jul 14 09:11:27 EDT 1997