From 382f3ce4f1767b0591ec6c98de715be0f1292b57 Mon Sep 17 00:00:00 2001 From: simonmar Date: Wed, 14 Mar 2001 14:44:34 +0000 Subject: [PATCH] [project @ 2001-03-14 14:44:34 by simonmar] don't consider SCC annotations in an argument to be trivial. --- ghc/compiler/coreSyn/CorePrep.lhs | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/ghc/compiler/coreSyn/CorePrep.lhs b/ghc/compiler/coreSyn/CorePrep.lhs index 6b3877d..13c642d 100644 --- a/ghc/compiler/coreSyn/CorePrep.lhs +++ b/ghc/compiler/coreSyn/CorePrep.lhs @@ -10,7 +10,7 @@ module CorePrep ( #include "HsVersions.h" -import CoreUtils( exprIsTrivial, exprIsAtom, exprType, exprIsValue, etaExpand ) +import CoreUtils( exprIsAtom, exprType, exprIsValue, etaExpand ) import CoreFVs ( exprFreeVars ) import CoreLint ( endPass ) import CoreSyn @@ -173,6 +173,18 @@ corePrepArg env arg dem needs_binding | opt_KeepStgTypes = exprIsAtom | otherwise = exprIsTrivial +-- version that doesn't consider an scc annotation to be trivial. +exprIsTrivial (Var v) + | hasNoBinding v = idArity v == 0 + | otherwise = True +exprIsTrivial (Type _) = True +exprIsTrivial (Lit lit) = True +exprIsTrivial (App e arg) = isTypeArg arg && exprIsTrivial e +exprIsTrivial (Note (SCC _) e) = False +exprIsTrivial (Note _ e) = exprIsTrivial e +exprIsTrivial (Lam b body) | isTyVar b = exprIsTrivial body +exprIsTrivial other = False + -- --------------------------------------------------------------------------- -- Dealing with expressions -- --------------------------------------------------------------------------- -- 1.7.10.4