Skip to main navigation Skip to search Skip to main content

Constraint systems for useless variable elimination

  • Mitchell Wand
  • , Igor Siveroni

Research output: Contribution to journalConference articlepeer-review

35 Scopus citations

Abstract

A useless variable is one whose value contributes nothing to the final outcome of a computation. Such variables are unlikely to occur in human-produced code, but may be introduced by various program transformations. We would like to eliminate useless parameters from procedures and eliminate the corresponding actual parameters from their call sites. This transformation is the extension to higher-order programming of a variety of dead-code elimination optimizations that are important in compilers for first-order imperative languages. Shivers has presented such a transformation. We reformulate the transformation and prove its correctness. We believe that this correctness proof can be a model for proofs of other analysis-based transformations. We proceed as follows: We reformulate Shivers' analysis as a set of constraints; since the constraints are conditional inclusions, they can be solved using standard algorithms. We prove that any solution to the constraints is sound: that two computations that differ only on variables marked as useless give the same answer up to useless variables, and hence the same answer when the answer is a constant. We observe that this notion of soundness is too weak to support the transformation of the analyzed program. We add additional closure conditions to the analysis and show that any solution to the new set of constraints justifies the transformation. The proof is by tree surgery: we show that from any computation of the original program, we can construct a computation of the transformed program that yields an answer related to the original, and the same answer when the original answer is a constant.

Original languageEnglish
Pages (from-to)291-302
Number of pages12
JournalConference Record of the Annual ACM Symposium on Principles of Programming Languages
StatePublished - 1999
Externally publishedYes
EventProceedings of the 1999 26th Annual ACM SIGPLAN-SIGACT Symposium on Principles of Programming Language, POPL'99 - San Antonio, TX, USA
Duration: 20 Jan 199922 Jan 1999

Fingerprint

Dive into the research topics of 'Constraint systems for useless variable elimination'. Together they form a unique fingerprint.

Cite this