summaryrefslogtreecommitdiff
path: root/compiler/GHC/Types
diff options
context:
space:
mode:
Diffstat (limited to 'compiler/GHC/Types')
-rw-r--r--compiler/GHC/Types/Id.hs11
1 files changed, 9 insertions, 2 deletions
diff --git a/compiler/GHC/Types/Id.hs b/compiler/GHC/Types/Id.hs
index 55ff3f9335..7c78c1928b 100644
--- a/compiler/GHC/Types/Id.hs
+++ b/compiler/GHC/Types/Id.hs
@@ -94,7 +94,7 @@ module GHC.Types.Id (
-- ** Reading 'IdInfo' fields
idArity,
idCallArity, idFunRepArity,
- idUnfolding, realIdUnfolding,
+ idUnfolding, realIdUnfolding, hasInlineUnfolding,
idSpecialisation, idCoreRules, idHasRules,
idCafInfo, idLFInfo_maybe,
idOneShotInfo, idStateHackOneShotInfo,
@@ -124,7 +124,8 @@ module GHC.Types.Id (
import GHC.Prelude
import GHC.Core ( CoreRule, isStableUnfolding, evaldUnfolding,
- isCompulsoryUnfolding, Unfolding( NoUnfolding ) )
+ isCompulsoryUnfolding, isInlineUnfolding,
+ Unfolding( NoUnfolding ) )
import GHC.Types.Id.Info
import GHC.Types.Basic
@@ -721,6 +722,12 @@ idUnfolding id
where
info = idInfo id
+hasInlineUnfolding :: Id -> Bool
+-- ^ True of a non-loop-breaker Id that has a /stable/ unfolding that is
+-- (a) always inlined; that is, with an `UnfWhen` guidance, or
+-- (b) a DFunUnfolding which never needs to be inlined
+hasInlineUnfolding id = isInlineUnfolding (idUnfolding id)
+
realIdUnfolding :: Id -> Unfolding
-- Expose the unfolding if there is one, including for loop breakers
realIdUnfolding id = unfoldingInfo (idInfo id)