diff options
author | Sebastian Graf <sebastian.graf@kit.edu> | 2021-07-21 15:47:06 +0200 |
---|---|---|
committer | Sebastian Graf <sebastian.graf@kit.edu> | 2021-09-16 14:13:22 +0200 |
commit | f6d5ce6d4cdde304213f5bde192c82b28f2fbdf1 (patch) | |
tree | 6c0cee4efb55eed43986d3ea2ce915243760bfb9 | |
parent | 297280d32bdb7c04cc5dece2055616e05b406534 (diff) | |
download | haskell-wip/sgraf-misc-2.tar.gz |
CoreUtils: Make exprIsHNF return True for unlifted variables (#20140)wip/sgraf-misc-2
Clearly, evaluating an unlifted variable will never perform any work.
Fixes #20140.
-rw-r--r-- | compiler/GHC/Core/Utils.hs | 2 |
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 |