[project @ 2003-09-11 16:46:15 by simonpj]
authorsimonpj <unknown>
Thu, 11 Sep 2003 16:46:15 +0000 (16:46 +0000)
committersimonpj <unknown>
Thu, 11 Sep 2003 16:46:15 +0000 (16:46 +0000)
Make sure that exprIsTrivial responds "False" to
(scc "foo" x)

We do not treat (_scc_ "foo" x) as trivial, because
  a) it really generates code, (and a heap object when it's
     a function arg) to capture the cost centre
  b) see the note [SCC-and-exprIsTrivial] in Simplify.simplLazyBind

ghc/compiler/coreSyn/CoreUtils.lhs

index 5c26e0d..882d469 100644 (file)
@@ -325,12 +325,18 @@ completely un-applied primops and foreign-call Ids are sufficiently
 rare that I plan to allow them to be duplicated and put up with
 saturating them.
 
+SCC notes.  We do not treat (_scc_ "foo" x) as trivial, because 
+  a) it really generates code, (and a heap object when it's 
+     a function arg) to capture the cost centre
+  b) see the note [SCC-and-exprIsTrivial] in Simplify.simplLazyBind
+
 \begin{code}
 exprIsTrivial (Var v)     = True       -- See notes above
 exprIsTrivial (Type _)    = True
 exprIsTrivial (Lit lit)    = litIsTrivial lit
 exprIsTrivial (App e arg)  = not (isRuntimeArg arg) && exprIsTrivial e
-exprIsTrivial (Note _ e)   = exprIsTrivial e
+exprIsTrivial (Note (SCC _) e) = False         -- See notes above
+exprIsTrivial (Note _       e) = exprIsTrivial e
 exprIsTrivial (Lam b body) = not (isRuntimeVar b) && exprIsTrivial body
 exprIsTrivial other       = False
 \end{code}