Commit 54b9b064 authored by Joachim Breitner's avatar Joachim Breitner
Browse files

Expose cseExpr from CSE

for the benefit of GHC API users who want to CSE single expressions.

Differential Revision: https://phabricator.haskell.org/D3069
parent 82121357
......@@ -6,7 +6,7 @@
{-# LANGUAGE CPP #-}
module CSE (cseProgram) where
module CSE (cseProgram, cseOneExpr) where
#include "HsVersions.h"
......@@ -373,6 +373,9 @@ tryForCSE toplevel env expr
-- top of the replaced sub-expression. This is probably not too
-- useful in practice, but upholds our semantics.
cseOneExpr :: CoreExpr -> CoreExpr
cseOneExpr = cseExpr emptyCSEnv
cseExpr :: CSEnv -> InExpr -> OutExpr
cseExpr env (Type t) = Type (substTy (csEnvSubst env) t)
cseExpr env (Coercion c) = Coercion (substCo (csEnvSubst env) c)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment