From 8f47436d4941e7871569e47bf8c2f5a6180bdbd5 Mon Sep 17 00:00:00 2001 From: "simonpj@microsoft.com" Date: Thu, 20 Dec 2007 17:34:32 +0000 Subject: [PATCH] Remove obselete code for update-in-place (which we no longer do) --- compiler/main/StaticFlags.hs | 2 -- compiler/simplCore/SimplUtils.lhs | 31 ++++--------------------------- 2 files changed, 4 insertions(+), 29 deletions(-) diff --git a/compiler/main/StaticFlags.hs b/compiler/main/StaticFlags.hs index 31b9414..a244544 100644 --- a/compiler/main/StaticFlags.hs +++ b/compiler/main/StaticFlags.hs @@ -59,7 +59,6 @@ module StaticFlags ( opt_UF_UseThreshold, opt_UF_FunAppDiscount, opt_UF_KeenessFactor, - opt_UF_UpdateInPlace, opt_UF_DearOp, -- Related to linking @@ -328,7 +327,6 @@ opt_UF_CreationThreshold = lookup_def_int "-funfolding-creation-threshold" (45: opt_UF_UseThreshold = lookup_def_int "-funfolding-use-threshold" (8::Int) -- Discounts can be big opt_UF_FunAppDiscount = lookup_def_int "-funfolding-fun-discount" (6::Int) -- It's great to inline a fn opt_UF_KeenessFactor = lookup_def_float "-funfolding-keeness-factor" (1.5::Float) -opt_UF_UpdateInPlace = lookUp FSLIT("-funfolding-update-in-place") opt_UF_DearOp = ( 4 :: Int) diff --git a/compiler/simplCore/SimplUtils.lhs b/compiler/simplCore/SimplUtils.lhs index cff659d..6ce29a2 100644 --- a/compiler/simplCore/SimplUtils.lhs +++ b/compiler/simplCore/SimplUtils.lhs @@ -95,10 +95,8 @@ data SimplCont Bool -- True <=> There is something interesting about -- the context, and hence the inliner -- should be a bit keener (see interestingCallContext) - -- Two cases: - -- (a) This is the RHS of a thunk whose type suggests - -- that update-in-place would be possible - -- (b) This is an argument of a function that has RULES + -- Specifically: + -- This is an argument of a function that has RULES -- Inlining the call might allow the rule to fire | CoerceIt -- C `cast` co @@ -156,10 +154,10 @@ mkBoringStop :: OutType -> SimplCont mkBoringStop ty = Stop ty AnArg False mkLazyArgStop :: OutType -> Bool -> SimplCont -mkLazyArgStop ty has_rules = Stop ty AnArg (canUpdateInPlace ty || has_rules) +mkLazyArgStop ty has_rules = Stop ty AnArg has_rules mkRhsStop :: OutType -> SimplCont -mkRhsStop ty = Stop ty AnRhs (canUpdateInPlace ty) +mkRhsStop ty = Stop ty AnRhs False ------------------- contIsRhsOrArg (Stop {}) = True @@ -400,27 +398,6 @@ interestingArgContext fn call_cont go (StrictBind {}) = False -- ?? go (CoerceIt _ c) = go c go (Stop _ _ interesting) = interesting - -------------------- -canUpdateInPlace :: Type -> Bool --- Consider let x = in ... --- If returns an explicit constructor, we might be able --- to do update in place. So we treat even a thunk RHS context --- as interesting if update in place is possible. We approximate --- this by seeing if the type has a single constructor with a --- small arity. But arity zero isn't good -- we share the single copy --- for that case, so no point in sharing. - -canUpdateInPlace ty - | not opt_UF_UpdateInPlace = False - | otherwise - = case splitTyConApp_maybe ty of - Nothing -> False - Just (tycon, _) -> case tyConDataCons_maybe tycon of - Just [dc] -> arity == 1 || arity == 2 - where - arity = dataConRepArity dc - other -> False \end{code} -- 1.7.10.4