diff options
author | Sebastian Graf <sebastian.graf@kit.edu> | 2021-07-21 15:47:06 +0200 |
---|---|---|
committer | Sebastian Graf <sebastian.graf@kit.edu> | 2021-07-21 15:48:21 +0200 |
commit | c089aea81241b3b02c7545f40282eeed7824ef8b (patch) | |
tree | ff27d61142fd427d057b755308bdca2a1c4c40b1 | |
parent | bb8e0df8f4187a4f4d0788dd3da3ef6f9268d378 (diff) | |
download | haskell-c089aea81241b3b02c7545f40282eeed7824ef8b.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.hs | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/compiler/GHC/Core/Utils.hs b/compiler/GHC/Core/Utils.hs index 12efdddcd4..331dd5c402 100644 --- a/compiler/GHC/Core/Utils.hs +++ b/compiler/GHC/Core/Utils.hs @@ -1906,6 +1906,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 evluated is_hnf_like (Lit l) = not (isLitRubbish l) -- Regarding a LitRubbish as ConLike leads to unproductive inlining in |