[commit: ghc] wip/T16039: implement exprIsTrivial too (f1cc917)

git at git.haskell.org git at git.haskell.org
Thu Dec 27 17:01:59 UTC 2018


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

On branch  : wip/T16039
Link       : http://ghc.haskell.org/trac/ghc/changeset/f1cc9177b0aa31e23011a93c0b40170775063ddb/ghc

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

commit f1cc9177b0aa31e23011a93c0b40170775063ddb
Author: Gabor Greif <ggreif at gmail.com>
Date:   Wed Dec 19 16:49:20 2018 +0100

    implement exprIsTrivial too


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

f1cc9177b0aa31e23011a93c0b40170775063ddb
 compiler/coreSyn/CoreUtils.hs | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/compiler/coreSyn/CoreUtils.hs b/compiler/coreSyn/CoreUtils.hs
index ea76f6d..ea3fe01 100644
--- a/compiler/coreSyn/CoreUtils.hs
+++ b/compiler/coreSyn/CoreUtils.hs
@@ -960,7 +960,11 @@ exprIsTrivial (Var _)          = True        -- See Note [Variables are trivial]
 exprIsTrivial (Type _)         = True
 exprIsTrivial (Coercion _)     = True
 exprIsTrivial (Lit lit)        = litIsTrivial lit
-exprIsTrivial (App e arg)      = not (isRuntimeArg arg) && exprIsTrivial e
+exprIsTrivial (App e arg)
+ | App (Var f) Type {} <- e
+ , f `hasKey` noinlineIdKey    = pprTrace "exprIsTrivial" (ppr arg) exprIsTrivial arg
+ | not (isRuntimeArg arg)      = exprIsTrivial e
+ | otherwise                   = False
 exprIsTrivial (Lam b e)        = not (isRuntimeVar b) && exprIsTrivial e
 exprIsTrivial (Tick t e)       = not (tickishIsCode t) && exprIsTrivial e
                                  -- See Note [Tick trivial]
@@ -1240,7 +1244,7 @@ exprIsCheapX ok_app e
                     | otherwise       = go n e
     go n (App f e)  | App (Var v) Type {} <- f
                     , v `hasKey` noinlineIdKey
-                    , isRuntimeArg e  = go n e
+                    , isRuntimeArg e  = pprTrace "exprIsCheapX" (ppr e) go n e
     go n (App f e)  | isRuntimeArg e  = go (n+1) f && ok e
                     | otherwise       = go n f
     go n (Let (NonRec _ r) e)         = go n e && ok r



More information about the ghc-commits mailing list