[Git][ghc/ghc][wip/torsten.schmits/23272] Filter out nontrivial substituted expressions in substTickish

Torsten Schmits (@torsten.schmits) gitlab at gitlab.haskell.org
Thu Jun 1 11:26:48 UTC 2023



Torsten Schmits pushed to branch wip/torsten.schmits/23272 at Glasgow Haskell Compiler / GHC


Commits:
c4938c96 by Torsten Schmits at 2023-06-01T13:26:33+02:00
Filter out nontrivial substituted expressions in substTickish

Fixes #23272

- - - - -


4 changed files:

- compiler/GHC/Core/Subst.hs
- + testsuite/tests/simplCore/should_compile/T23272.hs
- + testsuite/tests/simplCore/should_compile/T23272.script
- testsuite/tests/simplCore/should_compile/all.T


Changes:

=====================================
compiler/GHC/Core/Subst.hs
=====================================
@@ -592,9 +592,7 @@ substDVarSet subst@(Subst _ _ tv_env cv_env) fvs
 ------------------
 substTickish :: Subst -> CoreTickish -> CoreTickish
 substTickish subst (Breakpoint ext n ids)
-   = Breakpoint ext n (map do_one ids)
- where
-    do_one = getIdFromTrivialExpr . lookupIdSubst subst
+   = Breakpoint ext n [i | Var i <- lookupIdSubst subst <$> ids]
 substTickish _subst other = other
 
 {- Note [Substitute lazily]


=====================================
testsuite/tests/simplCore/should_compile/T23272.hs
=====================================
@@ -0,0 +1,9 @@
+module T23272 where
+
+class C a where
+instance C () where
+
+bug :: (forall a. C a => a -> a) -> ()
+bug g = f ()
+  where
+    f x = seq (g x) undefined


=====================================
testsuite/tests/simplCore/should_compile/T23272.script
=====================================
@@ -0,0 +1 @@
+:load T23272


=====================================
testsuite/tests/simplCore/should_compile/all.T
=====================================
@@ -484,3 +484,5 @@ test('T23307a', normal, compile, ['-O -ddump-simpl -dno-typeable-binds -dsuppres
 test('T23307b', normal, compile, ['-O'])
 test('T23307c', normal, compile, ['-O'])
 test('T23426', normal, compile, ['-O'])
+# test('T23272', [only_ways(['ghci']), extra_hc_opts('-fno-unoptimized-core-for-interpreter -O')], ghci_script, ['T23272.script'])
+test('T23272', normal, compile, ['-O -fbreak-points'])



View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/c4938c960a808ce2d16ef31e0ed98171f7def20e

-- 
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/c4938c960a808ce2d16ef31e0ed98171f7def20e
You're receiving this email because of your account on gitlab.haskell.org.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/ghc-commits/attachments/20230601/ebea7e87/attachment-0001.html>


More information about the ghc-commits mailing list