[Git][ghc/ghc][wip/spj-unf-size] Fix egregious error

Simon Peyton Jones (@simonpj) gitlab at gitlab.haskell.org
Wed Oct 25 21:12:38 UTC 2023



Simon Peyton Jones pushed to branch wip/spj-unf-size at Glasgow Haskell Compiler / GHC


Commits:
0a6e8228 by Simon Peyton Jones at 2023-10-25T22:12:22+01:00
Fix egregious error

- - - - -


1 changed file:

- compiler/GHC/Core/Unfold.hs


Changes:

=====================================
compiler/GHC/Core/Unfold.hs
=====================================
@@ -277,7 +277,7 @@ calcUnfoldingGuidance opts is_top_bottoming (Tick t expr)
 calcUnfoldingGuidance opts is_top_bottoming expr
   = case exprTree opts val_bndrs body of
       Nothing -> UnfNever
-      Just et@(ExprTree { et_size = tot })
+      Just et@(ExprTree { et_tot = tot })
         | uncondInline expr n_val_bndrs tot
         -> UnfWhen { ug_unsat_ok  = unSaturatedOk
                    , ug_boring_ok =  boringCxtOk
@@ -634,6 +634,7 @@ exprTree opts args expr
         go_alts cd vs b alts
 
     go_alts :: Int -> ETVars -> Id -> [CoreAlt] -> Maybe ExprTree
+    -- Add up the sizes of all RHSs, plus 10 for each alternative
     go_alts cd vs b alts = foldr1 et_add_alt (map alt_expr_tree alts)
       where
         cd1 = cd - 1
@@ -1002,7 +1003,7 @@ metAdd bOMB_OUT_SIZE (Just et1) (Just et2)
   , let t12 = t1 + t2
   = if   t12 >= bOMB_OUT_SIZE
     then Nothing
-    else Just (ExprTree { et_tot = t12
+    else Just (ExprTree { et_tot   = t12
                         , et_size  = n1 + n2
                         , et_cases = c1 `unionBags` c2
                         , et_ret   = ret2 })
@@ -1017,7 +1018,7 @@ metAddAlt bOMB_OUT_SIZE (Just et1) (Just et2)
   , let t12 = t1 + t2
   = if   t12 >= bOMB_OUT_SIZE
     then Nothing
-    else Just (ExprTree { et_tot = t12
+    else Just (ExprTree { et_tot   = t12
                         , et_size  = n1 + n2
                         , et_cases = c1 `unionBags` c2
                         , et_ret   = ret1 + ret2 })



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

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


More information about the ghc-commits mailing list