[Git][ghc/ghc][wip/andreask/mkTickUnsafeCoerce] Uphold the zipper structure.

Andreas Klebinger (@AndreasK) gitlab at gitlab.haskell.org
Thu Oct 17 14:50:59 UTC 2024



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


Commits:
1328fe35 by Andreas Klebinger at 2024-10-17T16:31:20+02:00
Uphold the zipper structure.

- - - - -


1 changed file:

- compiler/GHC/Core/Utils.hs


Changes:

=====================================
compiler/GHC/Core/Utils.hs
=====================================
@@ -305,7 +305,6 @@ 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
-
   -- 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).
@@ -316,10 +315,10 @@ mkTick t orig_expr = mkTick' id id orig_expr
           -> CoreExpr               -- current expression
           -> CoreExpr
   mkTick' top rest expr = case expr of
-    -- Float ticks into unsafe coerce.
+    -- Float ticks into unsafe coerce the same way we would do with a cast.
     Case scrut bndr ty alts@[Alt ac abs _rhs]
       | Just rhs <- isUnsafeEqualityCase scrut bndr alts
-      -> mkTick' (\e -> Case scrut bndr ty [Alt ac abs e]) rest rhs
+      -> top $ mkTick' (\e -> Case scrut bndr ty [Alt ac abs e]) rest rhs
 
     -- Cost centre ticks should never be reordered relative to each
     -- other. Therefore we can stop whenever two collide.



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

-- 
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/1328fe354923e2cbf84a5cd34bf1e47215f25141
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/0feec911/attachment-0001.html>


More information about the ghc-commits mailing list