Andreas Klebinger pushed to branch wip/andreask/ticked_joins at Glasgow Haskell Compiler / GHC
Commits:
-
6c07295a
by Andreas Klebinger at 2025-10-07T14:19:03+02:00
3 changed files:
Changes:
| ... | ... | @@ -899,9 +899,12 @@ lintCoreExpr (Tick tickish expr) |
| 899 | 899 | = do { case tickish of
|
| 900 | 900 | Breakpoint _ _ ids -> forM_ ids $ \id -> lintIdOcc id 0
|
| 901 | 901 | _ -> return ()
|
| 902 | - ; markAllJoinsBadIf block_joins $ lintCoreExpr expr }
|
|
| 902 | + ; expr_l <- lintCoreExpr expr
|
|
| 903 | + ; r <- markAllJoinsBadIf block_joins $ pure expr_l
|
|
| 904 | + -- ; when block_joins
|
|
| 905 | + ; pure r}
|
|
| 903 | 906 | where
|
| 904 | - block_joins = not (tickish `tickishScopesLike` SoftScope)
|
|
| 907 | + block_joins = not (tickishCanScopeJoin tickish)
|
|
| 905 | 908 | -- TODO Consider whether this is the correct rule. It is consistent with
|
| 906 | 909 | -- the simplifier's behaviour - cost-centre-scoped ticks become part of
|
| 907 | 910 | -- the continuation, and thus they behave like part of an evaluation
|
| ... | ... | @@ -2493,7 +2493,7 @@ occAnal env (Tick tickish body) |
| 2493 | 2493 | WUD usage body' = occAnal env body
|
| 2494 | 2494 | |
| 2495 | 2495 | usage'
|
| 2496 | - | tickish `tickishScopesLike` SoftScope || isProfTick tickish
|
|
| 2496 | + | tickishCanScopeJoin tickish
|
|
| 2497 | 2497 | = usage -- For soft-scoped ticks (including SourceNotes) we don't want
|
| 2498 | 2498 | -- to lose join-point-hood, so we don't mess with `usage` (#24078)
|
| 2499 | 2499 |
| ... | ... | @@ -15,6 +15,7 @@ module GHC.Types.Tickish ( |
| 15 | 15 | tickishScopesLike,
|
| 16 | 16 | tickishFloatable,
|
| 17 | 17 | tickishCanSplit,
|
| 18 | + tickishCanScopeJoin,
|
|
| 18 | 19 | mkNoCount,
|
| 19 | 20 | mkNoScope,
|
| 20 | 21 | tickishIsCode,
|
| ... | ... | @@ -324,6 +325,14 @@ tickishCanSplit ProfNote{profNoteScope = True, profNoteCount = True} |
| 324 | 325 | = True
|
| 325 | 326 | tickishCanSplit _ = False
|
| 326 | 327 | |
| 328 | +-- | Is @join f x in <tick> jump f x@ valid?
|
|
| 329 | +tickishCanScopeJoin :: GenTickish pass -> Bool
|
|
| 330 | +tickishCanScopeJoin tick = case tick of
|
|
| 331 | + ProfNote{} -> True
|
|
| 332 | + HpcTick{} -> False
|
|
| 333 | + Breakpoint{} -> False
|
|
| 334 | + SourceNote{} -> True
|
|
| 335 | + |
|
| 327 | 336 | mkNoCount :: GenTickish pass -> GenTickish pass
|
| 328 | 337 | mkNoCount n | not (tickishCounts n) = n
|
| 329 | 338 | | not (tickishCanSplit n) = panic "mkNoCount: Cannot split!"
|