summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSebastian Graf <sebastian.graf@kit.edu>2021-07-21 15:47:06 +0200
committerMarge Bot <ben+marge-bot@smart-cactus.org>2021-09-18 12:01:44 -0400
commit2c28919f9c79a65d65a2e863a9bd7d0785b5f854 (patch)
treee1215af0bfcd84c4c6b5cf2db53a85b4401de07d
parent4d245e548d4136a2034d4ec6171268eac2442fb8 (diff)
downloadhaskell-2c28919f9c79a65d65a2e863a9bd7d0785b5f854.tar.gz
CoreUtils: Make exprIsHNF return True for unlifted variables (#20140)
Clearly, evaluating an unlifted variable will never perform any work. Fixes #20140.
-rw-r--r--compiler/GHC/Core/Utils.hs2
1 files changed, 2 insertions, 0 deletions
diff --git a/compiler/GHC/Core/Utils.hs b/compiler/GHC/Core/Utils.hs
index b2af755e78..03d3fca294 100644
--- a/compiler/GHC/Core/Utils.hs
+++ b/compiler/GHC/Core/Utils.hs
@@ -1944,6 +1944,8 @@ exprIsHNFlike is_con is_con_unf = is_hnf_like
-- We don't look through loop breakers here, which is a bit conservative
-- but otherwise I worry that if an Id's unfolding is just itself,
-- we could get an infinite loop
+ || isUnliftedType (idType v)
+ -- Unlifted binders are always evaluated (#20140)
is_hnf_like (Lit l) = not (isLitRubbish l)
-- Regarding a LitRubbish as ConLike leads to unproductive inlining in