diff options
-rw-r--r-- | compiler/main/TidyPgm.hs | 7 | ||||
-rw-r--r-- | compiler/specialise/Specialise.hs | 6 |
2 files changed, 11 insertions, 2 deletions
diff --git a/compiler/main/TidyPgm.hs b/compiler/main/TidyPgm.hs index 8f2e3342f2..6bbd55611a 100644 --- a/compiler/main/TidyPgm.hs +++ b/compiler/main/TidyPgm.hs @@ -58,6 +58,7 @@ import ErrUtils (Severity(..)) import Outputable import SrcLoc import qualified ErrUtils as Err +import TcType ( isOverloadedTy ) import Control.Monad import Data.Function @@ -726,6 +727,7 @@ addExternal expose_all id = (new_needed_ids, show_unfold) never_active = isNeverActive (inlinePragmaActivation (inlinePragInfo idinfo)) loop_breaker = isStrongLoopBreaker (occInfo idinfo) bottoming_fn = isBottomingSig (strictnessInfo idinfo) + is_overloaded = isOverloadedTy (idType id) -- Stuff to do with the Id's unfolding -- We leave the unfolding there even if there is a worker @@ -737,11 +739,14 @@ addExternal expose_all id = (new_needed_ids, show_unfold) || isStableSource src -- Always expose things whose -- source is an inline rule - || not (bottoming_fn -- No need to inline bottom functions || never_active -- Or ones that say not to || loop_breaker -- Or that are loop breakers || neverUnfoldGuidance guidance) + || (if is_overloaded + then pprTrace "ADDITIONAL UNFOLDING:" (ppr id) True + else False) -- Always expose overloaded things so that + -- they can be specialised at call sites. show_unfolding (DFunUnfolding {}) = True show_unfolding _ = False diff --git a/compiler/specialise/Specialise.hs b/compiler/specialise/Specialise.hs index 33ce1acbde..159fbf7248 100644 --- a/compiler/specialise/Specialise.hs +++ b/compiler/specialise/Specialise.hs @@ -753,13 +753,17 @@ wantSpecImport dflags unf NoUnfolding -> False OtherCon {} -> False DFunUnfolding {} -> True - CoreUnfolding { uf_src = src, uf_guidance = _guidance } + CoreUnfolding { uf_src = src, uf_guidance = _guidance } -> True + +{- | gopt Opt_SpecialiseAggressively dflags -> True | isStableSource src -> True -- Specialise even INLINE things; it hasn't inlined yet, -- so perhaps it never will. Moreover it may have calls -- inside it that we want to specialise | otherwise -> False -- Stable, not INLINE, hence INLINEABLE + | otherwise -> False -- Stable, not INLINE, hence INLINABLE +-} {- Note [Warning about missed specialisations] ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |