[Git][ghc/ghc][wip/T17521] Avoid banged fields

Jaro Reinders (@Noughtmare) gitlab at gitlab.haskell.org
Tue Jul 18 09:38:58 UTC 2023



Jaro Reinders pushed to branch wip/T17521 at Glasgow Haskell Compiler / GHC


Commits:
9cad0331 by Jaro Reinders at 2023-07-18T11:38:49+02:00
Avoid banged fields

- - - - -


1 changed file:

- compiler/GHC/Core/Utils.hs


Changes:

=====================================
compiler/GHC/Core/Utils.hs
=====================================
@@ -2038,13 +2038,16 @@ exprIsTickedString = isJust . exprIsTickedString_maybe
 exprIsNestedTrivialConApp :: CoreExpr -> Bool
 exprIsNestedTrivialConApp x
   | (Var v, xs) <- collectArgs x
-  = isDataConWorkId v && all go xs
+  , Just dc <- isDataConWorkId_maybe v
+  = and (zipWith f (map isBanged (dataConImplBangs dc)) xs)
   where
-    go x
-      | exprIsTrivial x
+    f bang x
+      | not bang
+      , exprIsTrivial x
       = True
       | (Var v, xs) <- collectArgs x
-      = isDataConWorkId v && all go xs
+      , Just dc <- isDataConWorkId_maybe v
+      = and (zipWith f (map isBanged (dataConImplBangs dc)) xs) 
       | otherwise
       = False
 exprIsNestedTrivialConApp _ = False



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

-- 
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/9cad0331a286d05703fcf031430070ca5e3912dc
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/20230718/39cabe4f/attachment-0001.html>


More information about the ghc-commits mailing list