Compute demand signatures assuming idArity
[ghc.git] / compiler / basicTypes / IdInfo.hs
1 {-
2 (c) The University of Glasgow 2006
3 (c) The GRASP/AQUA Project, Glasgow University, 1993-1998
4
5 \section[IdInfo]{@IdInfos@: Non-essential information about @Ids@}
6
7 (And a pretty good illustration of quite a few things wrong with
8 Haskell. [WDP 94/11])
9 -}
10
11 {-# LANGUAGE CPP #-}
12 {-# LANGUAGE FlexibleContexts #-}
13
14 module IdInfo (
15 -- * The IdDetails type
16 IdDetails(..), pprIdDetails, coVarDetails, isCoVarDetails,
17 JoinArity, isJoinIdDetails_maybe,
18 RecSelParent(..),
19
20 -- * The IdInfo type
21 IdInfo, -- Abstract
22 vanillaIdInfo, noCafIdInfo,
23
24 -- ** The OneShotInfo type
25 OneShotInfo(..),
26 oneShotInfo, noOneShotInfo, hasNoOneShotInfo,
27 setOneShotInfo,
28
29 -- ** Zapping various forms of Info
30 zapLamInfo, zapFragileInfo,
31 zapDemandInfo, zapUsageInfo, zapUsageEnvInfo, zapUsedOnceInfo,
32 zapTailCallInfo, zapCallArityInfo, zapUnfolding,
33
34 -- ** The ArityInfo type
35 ArityInfo,
36 unknownArity,
37 arityInfo, setArityInfo, ppArityInfo,
38
39 callArityInfo, setCallArityInfo,
40
41 -- ** Demand and strictness Info
42 strictnessInfo, setStrictnessInfo,
43 demandInfo, setDemandInfo, pprStrictness,
44
45 -- ** Unfolding Info
46 unfoldingInfo, setUnfoldingInfo,
47
48 -- ** The InlinePragInfo type
49 InlinePragInfo,
50 inlinePragInfo, setInlinePragInfo,
51
52 -- ** The OccInfo type
53 OccInfo(..),
54 isDeadOcc, isStrongLoopBreaker, isWeakLoopBreaker,
55 occInfo, setOccInfo,
56
57 InsideLam, OneBranch,
58 insideLam, notInsideLam, oneBranch, notOneBranch,
59
60 TailCallInfo(..),
61 tailCallInfo, isAlwaysTailCalled,
62
63 -- ** The RuleInfo type
64 RuleInfo(..),
65 emptyRuleInfo,
66 isEmptyRuleInfo, ruleInfoFreeVars,
67 ruleInfoRules, setRuleInfoHead,
68 ruleInfo, setRuleInfo,
69
70 -- ** The CAFInfo type
71 CafInfo(..),
72 ppCafInfo, mayHaveCafRefs,
73 cafInfo, setCafInfo,
74
75 -- ** Tick-box Info
76 TickBoxOp(..), TickBoxId,
77
78 -- ** Levity info
79 LevityInfo, levityInfo, setNeverLevPoly, setLevityInfoWithType,
80 isNeverLevPolyIdInfo
81 ) where
82
83 #include "HsVersions.h"
84
85 import GhcPrelude
86
87 import CoreSyn
88
89 import Class
90 import {-# SOURCE #-} PrimOp (PrimOp)
91 import Name
92 import VarSet
93 import BasicTypes
94 import DataCon
95 import TyCon
96 import PatSyn
97 import Type
98 import ForeignCall
99 import Outputable
100 import Module
101 import Demand
102 import Util
103
104 -- infixl so you can say (id `set` a `set` b)
105 infixl 1 `setRuleInfo`,
106 `setArityInfo`,
107 `setInlinePragInfo`,
108 `setUnfoldingInfo`,
109 `setOneShotInfo`,
110 `setOccInfo`,
111 `setCafInfo`,
112 `setStrictnessInfo`,
113 `setDemandInfo`,
114 `setNeverLevPoly`,
115 `setLevityInfoWithType`
116
117 {-
118 ************************************************************************
119 * *
120 IdDetails
121 * *
122 ************************************************************************
123 -}
124
125 -- | Identifier Details
126 --
127 -- The 'IdDetails' of an 'Id' give stable, and necessary,
128 -- information about the Id.
129 data IdDetails
130 = VanillaId
131
132 -- | The 'Id' for a record selector
133 | RecSelId
134 { sel_tycon :: RecSelParent
135 , sel_naughty :: Bool -- True <=> a "naughty" selector which can't actually exist, for example @x@ in:
136 -- data T = forall a. MkT { x :: a }
137 } -- See Note [Naughty record selectors] in TcTyClsDecls
138
139 | DataConWorkId DataCon -- ^ The 'Id' is for a data constructor /worker/
140 | DataConWrapId DataCon -- ^ The 'Id' is for a data constructor /wrapper/
141
142 -- [the only reasons we need to know is so that
143 -- a) to support isImplicitId
144 -- b) when desugaring a RecordCon we can get
145 -- from the Id back to the data con]
146 | ClassOpId Class -- ^ The 'Id' is a superclass selector,
147 -- or class operation of a class
148
149 | PrimOpId PrimOp -- ^ The 'Id' is for a primitive operator
150 | FCallId ForeignCall -- ^ The 'Id' is for a foreign call.
151 -- Type will be simple: no type families, newtypes, etc
152
153 | TickBoxOpId TickBoxOp -- ^ The 'Id' is for a HPC tick box (both traditional and binary)
154
155 | DFunId Bool -- ^ A dictionary function.
156 -- Bool = True <=> the class has only one method, so may be
157 -- implemented with a newtype, so it might be bad
158 -- to be strict on this dictionary
159
160 | CoVarId -- ^ A coercion variable
161 -- This only covers /un-lifted/ coercions, of type
162 -- (t1 ~# t2) or (t1 ~R# t2), not their lifted variants
163 | JoinId JoinArity -- ^ An 'Id' for a join point taking n arguments
164 -- Note [Join points] in CoreSyn
165
166 -- | Recursive Selector Parent
167 data RecSelParent = RecSelData TyCon | RecSelPatSyn PatSyn deriving Eq
168 -- Either `TyCon` or `PatSyn` depending
169 -- on the origin of the record selector.
170 -- For a data type family, this is the
171 -- /instance/ 'TyCon' not the family 'TyCon'
172
173 instance Outputable RecSelParent where
174 ppr p = case p of
175 RecSelData ty_con -> ppr ty_con
176 RecSelPatSyn ps -> ppr ps
177
178 -- | Just a synonym for 'CoVarId'. Written separately so it can be
179 -- exported in the hs-boot file.
180 coVarDetails :: IdDetails
181 coVarDetails = CoVarId
182
183 -- | Check if an 'IdDetails' says 'CoVarId'.
184 isCoVarDetails :: IdDetails -> Bool
185 isCoVarDetails CoVarId = True
186 isCoVarDetails _ = False
187
188 isJoinIdDetails_maybe :: IdDetails -> Maybe JoinArity
189 isJoinIdDetails_maybe (JoinId join_arity) = Just join_arity
190 isJoinIdDetails_maybe _ = Nothing
191
192 instance Outputable IdDetails where
193 ppr = pprIdDetails
194
195 pprIdDetails :: IdDetails -> SDoc
196 pprIdDetails VanillaId = empty
197 pprIdDetails other = brackets (pp other)
198 where
199 pp VanillaId = panic "pprIdDetails"
200 pp (DataConWorkId _) = text "DataCon"
201 pp (DataConWrapId _) = text "DataConWrapper"
202 pp (ClassOpId {}) = text "ClassOp"
203 pp (PrimOpId _) = text "PrimOp"
204 pp (FCallId _) = text "ForeignCall"
205 pp (TickBoxOpId _) = text "TickBoxOp"
206 pp (DFunId nt) = text "DFunId" <> ppWhen nt (text "(nt)")
207 pp (RecSelId { sel_naughty = is_naughty })
208 = brackets $ text "RecSel" <>
209 ppWhen is_naughty (text "(naughty)")
210 pp CoVarId = text "CoVarId"
211 pp (JoinId arity) = text "JoinId" <> parens (int arity)
212
213 {-
214 ************************************************************************
215 * *
216 \subsection{The main IdInfo type}
217 * *
218 ************************************************************************
219 -}
220
221 -- | Identifier Information
222 --
223 -- An 'IdInfo' gives /optional/ information about an 'Id'. If
224 -- present it never lies, but it may not be present, in which case there
225 -- is always a conservative assumption which can be made.
226 --
227 -- Two 'Id's may have different info even though they have the same
228 -- 'Unique' (and are hence the same 'Id'); for example, one might lack
229 -- the properties attached to the other.
230 --
231 -- Most of the 'IdInfo' gives information about the value, or definition, of
232 -- the 'Id', independent of its usage. Exceptions to this
233 -- are 'demandInfo', 'occInfo', 'oneShotInfo' and 'callArityInfo'.
234 --
235 -- Performance note: when we update 'IdInfo', we have to reallocate this
236 -- entire record, so it is a good idea not to let this data structure get
237 -- too big.
238 data IdInfo
239 = IdInfo {
240 arityInfo :: !ArityInfo,
241 -- ^ 'Id' arity, as computed by 'CoreArity'. Specifies how many
242 -- arguments this 'Id' has to be applied to before it doesn any
243 -- meaningful work.
244 ruleInfo :: RuleInfo,
245 -- ^ Specialisations of the 'Id's function which exist.
246 -- See Note [Specialisations and RULES in IdInfo]
247 unfoldingInfo :: Unfolding,
248 -- ^ The 'Id's unfolding
249 cafInfo :: CafInfo,
250 -- ^ 'Id' CAF info
251 oneShotInfo :: OneShotInfo,
252 -- ^ Info about a lambda-bound variable, if the 'Id' is one
253 inlinePragInfo :: InlinePragma,
254 -- ^ Any inline pragma atached to the 'Id'
255 occInfo :: OccInfo,
256 -- ^ How the 'Id' occurs in the program
257 strictnessInfo :: StrictSig,
258 -- ^ A strictness signature. Digests how a function uses its arguments
259 -- if applied to at least 'arityInfo' arguments.
260 demandInfo :: Demand,
261 -- ^ ID demand information
262 callArityInfo :: !ArityInfo,
263 -- ^ How this is called. This is the number of arguments to which a
264 -- binding can be eta-expanded without losing any sharing.
265 -- n <=> all calls have at least n arguments
266 levityInfo :: LevityInfo
267 -- ^ when applied, will this Id ever have a levity-polymorphic type?
268 }
269
270 -- Setters
271
272 setRuleInfo :: IdInfo -> RuleInfo -> IdInfo
273 setRuleInfo info sp = sp `seq` info { ruleInfo = sp }
274 setInlinePragInfo :: IdInfo -> InlinePragma -> IdInfo
275 setInlinePragInfo info pr = pr `seq` info { inlinePragInfo = pr }
276 setOccInfo :: IdInfo -> OccInfo -> IdInfo
277 setOccInfo info oc = oc `seq` info { occInfo = oc }
278 -- Try to avoid space leaks by seq'ing
279
280 setUnfoldingInfo :: IdInfo -> Unfolding -> IdInfo
281 setUnfoldingInfo info uf
282 = -- We don't seq the unfolding, as we generate intermediate
283 -- unfoldings which are just thrown away, so evaluating them is a
284 -- waste of time.
285 -- seqUnfolding uf `seq`
286 info { unfoldingInfo = uf }
287
288 setArityInfo :: IdInfo -> ArityInfo -> IdInfo
289 setArityInfo info ar = info { arityInfo = ar }
290 setCallArityInfo :: IdInfo -> ArityInfo -> IdInfo
291 setCallArityInfo info ar = info { callArityInfo = ar }
292 setCafInfo :: IdInfo -> CafInfo -> IdInfo
293 setCafInfo info caf = info { cafInfo = caf }
294
295 setOneShotInfo :: IdInfo -> OneShotInfo -> IdInfo
296 setOneShotInfo info lb = {-lb `seq`-} info { oneShotInfo = lb }
297
298 setDemandInfo :: IdInfo -> Demand -> IdInfo
299 setDemandInfo info dd = dd `seq` info { demandInfo = dd }
300
301 setStrictnessInfo :: IdInfo -> StrictSig -> IdInfo
302 setStrictnessInfo info dd = dd `seq` info { strictnessInfo = dd }
303
304 -- | Basic 'IdInfo' that carries no useful information whatsoever
305 vanillaIdInfo :: IdInfo
306 vanillaIdInfo
307 = IdInfo {
308 cafInfo = vanillaCafInfo,
309 arityInfo = unknownArity,
310 ruleInfo = emptyRuleInfo,
311 unfoldingInfo = noUnfolding,
312 oneShotInfo = NoOneShotInfo,
313 inlinePragInfo = defaultInlinePragma,
314 occInfo = noOccInfo,
315 demandInfo = topDmd,
316 strictnessInfo = nopSig,
317 callArityInfo = unknownArity,
318 levityInfo = NoLevityInfo
319 }
320
321 -- | More informative 'IdInfo' we can use when we know the 'Id' has no CAF references
322 noCafIdInfo :: IdInfo
323 noCafIdInfo = vanillaIdInfo `setCafInfo` NoCafRefs
324 -- Used for built-in type Ids in MkId.
325
326 {-
327 ************************************************************************
328 * *
329 \subsection[arity-IdInfo]{Arity info about an @Id@}
330 * *
331 ************************************************************************
332
333 For locally-defined Ids, the code generator maintains its own notion
334 of their arities; so it should not be asking... (but other things
335 besides the code-generator need arity info!)
336 -}
337
338 -- | Arity Information
339 --
340 -- An 'ArityInfo' of @n@ tells us that partial application of this
341 -- 'Id' to up to @n-1@ value arguments does essentially no work.
342 --
343 -- That is not necessarily the same as saying that it has @n@ leading
344 -- lambdas, because coerces may get in the way.
345 --
346 -- The arity might increase later in the compilation process, if
347 -- an extra lambda floats up to the binding site.
348 type ArityInfo = Arity
349
350 -- | It is always safe to assume that an 'Id' has an arity of 0
351 unknownArity :: Arity
352 unknownArity = 0
353
354 ppArityInfo :: Int -> SDoc
355 ppArityInfo 0 = empty
356 ppArityInfo n = hsep [text "Arity", int n]
357
358 {-
359 ************************************************************************
360 * *
361 \subsection{Inline-pragma information}
362 * *
363 ************************************************************************
364 -}
365
366 -- | Inline Pragma Information
367 --
368 -- Tells when the inlining is active.
369 -- When it is active the thing may be inlined, depending on how
370 -- big it is.
371 --
372 -- If there was an @INLINE@ pragma, then as a separate matter, the
373 -- RHS will have been made to look small with a Core inline 'Note'
374 --
375 -- The default 'InlinePragInfo' is 'AlwaysActive', so the info serves
376 -- entirely as a way to inhibit inlining until we want it
377 type InlinePragInfo = InlinePragma
378
379 {-
380 ************************************************************************
381 * *
382 Strictness
383 * *
384 ************************************************************************
385 -}
386
387 pprStrictness :: StrictSig -> SDoc
388 pprStrictness sig = ppr sig
389
390 {-
391 ************************************************************************
392 * *
393 RuleInfo
394 * *
395 ************************************************************************
396
397 Note [Specialisations and RULES in IdInfo]
398 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
399 Generally speaking, a GlobalId has an *empty* RuleInfo. All their
400 RULES are contained in the globally-built rule-base. In principle,
401 one could attach the to M.f the RULES for M.f that are defined in M.
402 But we don't do that for instance declarations and so we just treat
403 them all uniformly.
404
405 The EXCEPTION is PrimOpIds, which do have rules in their IdInfo. That is
406 jsut for convenience really.
407
408 However, LocalIds may have non-empty RuleInfo. We treat them
409 differently because:
410 a) they might be nested, in which case a global table won't work
411 b) the RULE might mention free variables, which we use to keep things alive
412
413 In TidyPgm, when the LocalId becomes a GlobalId, its RULES are stripped off
414 and put in the global list.
415 -}
416
417 -- | Rule Information
418 --
419 -- Records the specializations of this 'Id' that we know about
420 -- in the form of rewrite 'CoreRule's that target them
421 data RuleInfo
422 = RuleInfo
423 [CoreRule]
424 DVarSet -- Locally-defined free vars of *both* LHS and RHS
425 -- of rules. I don't think it needs to include the
426 -- ru_fn though.
427 -- Note [Rule dependency info] in OccurAnal
428
429 -- | Assume that no specilizations exist: always safe
430 emptyRuleInfo :: RuleInfo
431 emptyRuleInfo = RuleInfo [] emptyDVarSet
432
433 isEmptyRuleInfo :: RuleInfo -> Bool
434 isEmptyRuleInfo (RuleInfo rs _) = null rs
435
436 -- | Retrieve the locally-defined free variables of both the left and
437 -- right hand sides of the specialization rules
438 ruleInfoFreeVars :: RuleInfo -> DVarSet
439 ruleInfoFreeVars (RuleInfo _ fvs) = fvs
440
441 ruleInfoRules :: RuleInfo -> [CoreRule]
442 ruleInfoRules (RuleInfo rules _) = rules
443
444 -- | Change the name of the function the rule is keyed on on all of the 'CoreRule's
445 setRuleInfoHead :: Name -> RuleInfo -> RuleInfo
446 setRuleInfoHead fn (RuleInfo rules fvs)
447 = RuleInfo (map (setRuleIdName fn) rules) fvs
448
449 {-
450 ************************************************************************
451 * *
452 \subsection[CG-IdInfo]{Code generator-related information}
453 * *
454 ************************************************************************
455 -}
456
457 -- CafInfo is used to build Static Reference Tables (see simplStg/SRT.hs).
458
459 -- | Constant applicative form Information
460 --
461 -- Records whether an 'Id' makes Constant Applicative Form references
462 data CafInfo
463 = MayHaveCafRefs -- ^ Indicates that the 'Id' is for either:
464 --
465 -- 1. A function or static constructor
466 -- that refers to one or more CAFs, or
467 --
468 -- 2. A real live CAF
469
470 | NoCafRefs -- ^ A function or static constructor
471 -- that refers to no CAFs.
472 deriving (Eq, Ord)
473
474 -- | Assumes that the 'Id' has CAF references: definitely safe
475 vanillaCafInfo :: CafInfo
476 vanillaCafInfo = MayHaveCafRefs
477
478 mayHaveCafRefs :: CafInfo -> Bool
479 mayHaveCafRefs MayHaveCafRefs = True
480 mayHaveCafRefs _ = False
481
482 instance Outputable CafInfo where
483 ppr = ppCafInfo
484
485 ppCafInfo :: CafInfo -> SDoc
486 ppCafInfo NoCafRefs = text "NoCafRefs"
487 ppCafInfo MayHaveCafRefs = empty
488
489 {-
490 ************************************************************************
491 * *
492 \subsection{Bulk operations on IdInfo}
493 * *
494 ************************************************************************
495 -}
496
497 -- | This is used to remove information on lambda binders that we have
498 -- setup as part of a lambda group, assuming they will be applied all at once,
499 -- but turn out to be part of an unsaturated lambda as in e.g:
500 --
501 -- > (\x1. \x2. e) arg1
502 zapLamInfo :: IdInfo -> Maybe IdInfo
503 zapLamInfo info@(IdInfo {occInfo = occ, demandInfo = demand})
504 | is_safe_occ occ && is_safe_dmd demand
505 = Nothing
506 | otherwise
507 = Just (info {occInfo = safe_occ, demandInfo = topDmd})
508 where
509 -- The "unsafe" occ info is the ones that say I'm not in a lambda
510 -- because that might not be true for an unsaturated lambda
511 is_safe_occ occ | isAlwaysTailCalled occ = False
512 is_safe_occ (OneOcc { occ_in_lam = in_lam }) = in_lam
513 is_safe_occ _other = True
514
515 safe_occ = case occ of
516 OneOcc{} -> occ { occ_in_lam = True
517 , occ_tail = NoTailCallInfo }
518 IAmALoopBreaker{}
519 -> occ { occ_tail = NoTailCallInfo }
520 _other -> occ
521
522 is_safe_dmd dmd = not (isStrictDmd dmd)
523
524 -- | Remove all demand info on the 'IdInfo'
525 zapDemandInfo :: IdInfo -> Maybe IdInfo
526 zapDemandInfo info = Just (info {demandInfo = topDmd})
527
528 -- | Remove usage (but not strictness) info on the 'IdInfo'
529 zapUsageInfo :: IdInfo -> Maybe IdInfo
530 zapUsageInfo info = Just (info {demandInfo = zapUsageDemand (demandInfo info)})
531
532 -- | Remove usage environment info from the strictness signature on the 'IdInfo'
533 zapUsageEnvInfo :: IdInfo -> Maybe IdInfo
534 zapUsageEnvInfo info
535 | hasDemandEnvSig (strictnessInfo info)
536 = Just (info {strictnessInfo = zapUsageEnvSig (strictnessInfo info)})
537 | otherwise
538 = Nothing
539
540 zapUsedOnceInfo :: IdInfo -> Maybe IdInfo
541 zapUsedOnceInfo info
542 = Just $ info { strictnessInfo = zapUsedOnceSig (strictnessInfo info)
543 , demandInfo = zapUsedOnceDemand (demandInfo info) }
544
545 zapFragileInfo :: IdInfo -> Maybe IdInfo
546 -- ^ Zap info that depends on free variables
547 zapFragileInfo info@(IdInfo { occInfo = occ, unfoldingInfo = unf })
548 = new_unf `seq` -- The unfolding field is not (currently) strict, so we
549 -- force it here to avoid a (zapFragileUnfolding unf) thunk
550 -- which might leak space
551 Just (info `setRuleInfo` emptyRuleInfo
552 `setUnfoldingInfo` new_unf
553 `setOccInfo` zapFragileOcc occ)
554 where
555 new_unf = zapFragileUnfolding unf
556
557 zapFragileUnfolding :: Unfolding -> Unfolding
558 zapFragileUnfolding unf
559 | isFragileUnfolding unf = noUnfolding
560 | otherwise = unf
561
562 zapUnfolding :: Unfolding -> Unfolding
563 -- Squash all unfolding info, preserving only evaluated-ness
564 zapUnfolding unf | isEvaldUnfolding unf = evaldUnfolding
565 | otherwise = noUnfolding
566
567 zapTailCallInfo :: IdInfo -> Maybe IdInfo
568 zapTailCallInfo info
569 = case occInfo info of
570 occ | isAlwaysTailCalled occ -> Just (info `setOccInfo` safe_occ)
571 | otherwise -> Nothing
572 where
573 safe_occ = occ { occ_tail = NoTailCallInfo }
574
575 zapCallArityInfo :: IdInfo -> IdInfo
576 zapCallArityInfo info = setCallArityInfo info 0
577
578 {-
579 ************************************************************************
580 * *
581 \subsection{TickBoxOp}
582 * *
583 ************************************************************************
584 -}
585
586 type TickBoxId = Int
587
588 -- | Tick box for Hpc-style coverage
589 data TickBoxOp
590 = TickBox Module {-# UNPACK #-} !TickBoxId
591
592 instance Outputable TickBoxOp where
593 ppr (TickBox mod n) = text "tick" <+> ppr (mod,n)
594
595 {-
596 ************************************************************************
597 * *
598 Levity
599 * *
600 ************************************************************************
601
602 Note [Levity info]
603 ~~~~~~~~~~~~~~~~~~
604
605 Ids store whether or not they can be levity-polymorphic at any amount
606 of saturation. This is helpful in optimizing the levity-polymorphism check
607 done in the desugarer, where we can usually learn that something is not
608 levity-polymorphic without actually figuring out its type. See
609 isExprLevPoly in CoreUtils for where this info is used. Storing
610 this is required to prevent perf/compiler/T5631 from blowing up.
611
612 -}
613
614 -- See Note [Levity info]
615 data LevityInfo = NoLevityInfo -- always safe
616 | NeverLevityPolymorphic
617 deriving Eq
618
619 instance Outputable LevityInfo where
620 ppr NoLevityInfo = text "NoLevityInfo"
621 ppr NeverLevityPolymorphic = text "NeverLevityPolymorphic"
622
623 -- | Marks an IdInfo describing an Id that is never levity polymorphic (even when
624 -- applied). The Type is only there for checking that it's really never levity
625 -- polymorphic
626 setNeverLevPoly :: HasDebugCallStack => IdInfo -> Type -> IdInfo
627 setNeverLevPoly info ty
628 = ASSERT2( not (resultIsLevPoly ty), ppr ty )
629 info { levityInfo = NeverLevityPolymorphic }
630
631 setLevityInfoWithType :: IdInfo -> Type -> IdInfo
632 setLevityInfoWithType info ty
633 | not (resultIsLevPoly ty)
634 = info { levityInfo = NeverLevityPolymorphic }
635 | otherwise
636 = info
637
638 isNeverLevPolyIdInfo :: IdInfo -> Bool
639 isNeverLevPolyIdInfo info
640 | NeverLevityPolymorphic <- levityInfo info = True
641 | otherwise = False