[commit: ghc] wip/T12618: maybe_substitute: Detect ConApp (5a0b128)

git at git.haskell.org git at git.haskell.org
Mon Oct 10 21:43:07 UTC 2016


Repository : ssh://git@git.haskell.org/ghc

On branch  : wip/T12618
Link       : http://ghc.haskell.org/trac/ghc/changeset/5a0b12869b7d9058348a4af42ef016da3d5b83ae/ghc

>---------------------------------------------------------------

commit 5a0b12869b7d9058348a4af42ef016da3d5b83ae
Author: Joachim Breitner <mail at joachim-breitner.de>
Date:   Fri Oct 7 17:39:42 2016 -0400

    maybe_substitute: Detect ConApp


>---------------------------------------------------------------

5a0b12869b7d9058348a4af42ef016da3d5b83ae
 compiler/coreSyn/CoreSubst.hs | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/compiler/coreSyn/CoreSubst.hs b/compiler/coreSyn/CoreSubst.hs
index 058ccfe..e211624 100644
--- a/compiler/coreSyn/CoreSubst.hs
+++ b/compiler/coreSyn/CoreSubst.hs
@@ -1082,11 +1082,14 @@ maybe_substitute subst b r
     safe_to_inline NoOccInfo                = trivial
 
     trivial | exprIsTrivial r = True
+                     -- See Note [Getting the map/coerce RULE to work]
+            | (ConApp dc args) <- r
+            , dc `hasKey` heqDataConKey || dc `hasKey` coercibleDataConKey
+            , all exprIsTrivial args = True
             | (Var fun, args) <- collectArgs r
             , Just dc <- isDataConWorkId_maybe fun
             , dc `hasKey` heqDataConKey || dc `hasKey` coercibleDataConKey
             , all exprIsTrivial args = True
-                     -- See Note [Getting the map/coerce RULE to work]
             | otherwise = False
 
 ----------------------



More information about the ghc-commits mailing list