[project @ 2001-03-19 16:24:37 by simonpj]
authorsimonpj <unknown>
Mon, 19 Mar 2001 16:24:37 +0000 (16:24 +0000)
committersimonpj <unknown>
Mon, 19 Mar 2001 16:24:37 +0000 (16:24 +0000)
---------------------------------------------
Be more eager to inline for an applied coerce
---------------------------------------------

Given this:

(coerce T f) x y

SimplUtils.interestingCallContext was returning False (uninteresting
call context).  This is wrong: it's a very intersting context.

Darn those coerces!  They are scheduled for destruction, but meanwhile,
this makes matters a bit better.

ghc/compiler/simplCore/SimplUtils.lhs

index f61b513..55e7fca 100644 (file)
@@ -369,7 +369,10 @@ interestingCallContext some_args some_val_args cont
   where
     interesting (InlinePlease _)       = True
     interesting (Select _ _ _ _ _)     = some_args
-    interesting (ApplyTo _ _ _ _)      = some_args     -- Can happen if we have (coerce t (f x)) y
+    interesting (ApplyTo _ _ _ _)      = True  -- Can happen if we have (coerce t (f x)) y
+                                               -- Perhaps True is a bit over-keen, but I've
+                                               -- seen (coerce f) x, where f has an INLINE prag,
+                                               -- So we have to give some motivaiton for inlining it
     interesting (ArgOf _ _ _)         = some_val_args
     interesting (Stop ty upd_in_place) = some_val_args && upd_in_place
     interesting (CoerceIt _ cont)      = interesting cont