diff options
| author | sheaf <sam.derbyshire@gmail.com> | 2022-07-21 15:37:22 +0200 |
|---|---|---|
| committer | sheaf <sam.derbyshire@gmail.com> | 2022-07-21 15:37:22 +0200 |
| commit | 81d65f7f358fdbd1d13b89c43fc4cbe3ac82d24b (patch) | |
| tree | 54254e42d773a4b9567204f49367627f5b4d77d9 /compiler/GHC/Builtin | |
| parent | e2f0094c315746ff15b8d9650cf318f81d8416d7 (diff) | |
| download | haskell-81d65f7f358fdbd1d13b89c43fc4cbe3ac82d24b.tar.gz | |
Make withDict opaque to the specialiser
As pointed out in #21575, it is not sufficient to set withDict to inline
after the typeclass specialiser, because we might inline withDict in one
module and then import it in another, and we run into the same problem.
This means we could still end up with incorrect runtime results because
the typeclass specialiser would assume that distinct typeclass evidence
terms at the same type are equal, when this is not necessarily the case
when using withDict.
Instead, this patch introduces a new magicId, 'nospec', which is only
inlined in CorePrep. We make use of it in the definition of withDict
to ensure that the typeclass specialiser does not common up distinct
typeclass evidence terms.
Fixes #21575
Diffstat (limited to 'compiler/GHC/Builtin')
| -rw-r--r-- | compiler/GHC/Builtin/Names.hs | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/compiler/GHC/Builtin/Names.hs b/compiler/GHC/Builtin/Names.hs index 115a7f53f4..f97103a90f 100644 --- a/compiler/GHC/Builtin/Names.hs +++ b/compiler/GHC/Builtin/Names.hs @@ -2332,6 +2332,9 @@ runRWKey = mkPreludeMiscIdUnique 107 traceKey :: Unique traceKey = mkPreludeMiscIdUnique 108 +nospecIdKey :: Unique +nospecIdKey = mkPreludeMiscIdUnique 109 + inlineIdKey, noinlineIdKey :: Unique inlineIdKey = mkPreludeMiscIdUnique 120 -- see below |
