[Git][ghc/ghc][wip/andreask/mkTickUnsafeCoerce] Don't push breakpoints because they are urkh

Andreas Klebinger (@AndreasK) gitlab at gitlab.haskell.org
Thu Oct 17 13:21:29 UTC 2024



Andreas Klebinger pushed to branch wip/andreask/mkTickUnsafeCoerce at Glasgow Haskell Compiler / GHC


Commits:
c767846f by Andreas Klebinger at 2024-10-17T15:02:04+02:00
Don't push breakpoints because they are urkh

- - - - -


1 changed file:

- compiler/GHC/Core/Utils.hs


Changes:

=====================================
compiler/GHC/Core/Utils.hs
=====================================
@@ -305,7 +305,9 @@ mkTick t orig_expr = mkTick' id id orig_expr
   -- Some ticks (cost-centres) can be split in two, with the
   -- non-counting part having laxer placement properties.
   canSplit = tickishCanSplit t && tickishPlace (mkNoCount t) /= tickishPlace t
-
+  isBreakpoint = case t of
+    Breakpoint{}  -> True
+    _             -> False
   -- mkTick' handles floating of ticks *into* the expression.
   -- In this function, `top` is applied after adding the tick, and `rest` before.
   -- This will result in applications that look like (top $ Tick t $ rest expr).
@@ -319,6 +321,10 @@ mkTick t orig_expr = mkTick' id id orig_expr
     -- Float ticks into unsafe coerce.
     Case scrut bndr ty alts@[Alt ac abs _rhs]
       | Just rhs <- isUnsafeEqualityCase scrut bndr alts
+      -- Moving breakpoints is around can be tricky. They capture in-scope Id's which
+      -- means there can be problems around shadowing and such.
+      -- Rather than deal with that complexity, we simply don't move them.
+      , not isBreakpoint
       -> mkTick' (\e -> Case scrut bndr ty [Alt ac abs e]) rest rhs
 
     -- Cost centre ticks should never be reordered relative to each



View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/c767846f2a8af2300be97969a239a888916a1603

-- 
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/c767846f2a8af2300be97969a239a888916a1603
You're receiving this email because of your account on gitlab.haskell.org.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/ghc-commits/attachments/20241017/f57aad31/attachment-0001.html>


More information about the ghc-commits mailing list