Type-based useless variable elimination

  • Authors:
  • Naoki Kobayashi

  • Affiliations:
  • University of Tokyo

  • Venue:
  • PEPM '00 Proceedings of the 2000 ACM SIGPLAN workshop on Partial evaluation and semantics-based program manipulation
  • Year:
  • 1999

Quantified Score

Hi-index 0.00

Visualization

Abstract

Useless variable elimination [25] is a transformation that eliminates variables whose values contribute nothing to the final outcome of a computation. We present a type-based method for useless variable elimination and prove its correctness. The algorithm is a surprisingly simple extension of the usual type reconstruction algorithm. Our method seems more attractive than other methods for useless variable elimination in several respects. First, it is simple, so that the proof of the correctness is clear and the method can be easily extended to deal with a polymorphic language. Second, it is efficient: it runs in time almost linear in the size of an input expression for a simply-typed &lgr;-calculus, while Wand and Siveroni's 0CFA-based method may require a cubic time. Moreover, our transformation is optimal in a certain sense among those that preserve well-typedness, both for the simply-typed language and for an ML-style polymorphically-typed language. On the other hand, Wand and Siveroni's method is not optimal for the polymophically-typed language.