School of Computing

Common Subexpression Elimination in a Lazy Functional Language

Olaf Chitil

In Chris Clack, Tony Davie, and Kevin Hammond, editors, Draft Proceedings of the 9th International Workshop on Implementation of Functional Languages, pages 182-196. St Andrews, Scotland, September 1997.


Common subexpression elimination is a well-known compiler optimisation that saves time by avoiding the repetition of the same computation. To our knowledge it has not yet been applied to lazy functional programming languages, although there are several advantages. First, the referential transparency of these languages makes the identification of common subexpressions very simple. Second, more common subexpressions can be recognised because they can be of arbitrary type whereas standard common subexpression elimination only shares primitive values. However, because lazy functional languages decouple program structure from data space allocation and control flow, analysing its effects and deciding under which conditions the elimination of a common subexpression is beneficial proves to be quite difficult. We developed and implemented the transformation for the language Haskell by extending the Glasgow Haskell compiler and measured its effectiveness on real-world programs.

Download publication 163 kbytes (PDF)

Bibtex Record

author = {Olaf Chitil},
title = {{Common Subexpression Elimination in a Lazy Functional Language}},
month = {September},
year = {1997},
pages = {182-196},
keywords = {determinacy analysis, Craig interpolants},
note = {},
doi = {},
url = {},
    publication_type = {inproceedings},
    submission_id = {20773_1083667093},
    other_year = {1997},
    organization = {St Andrews, Scotland},
    publisher = { },
    editor = {Chris Clack and Tony Davie and Kevin Hammond},
    booktitle = {Draft Proceedings of the 9th International Workshop on Implementation of Functional Languages},

School of Computing, University of Kent, Canterbury, Kent, CT2 7NF

Enquiries: +44 (0)1227 824180 or contact us.

Last Updated: 21/03/2014