[Git][ghc/ghc][wip/andreask/rules-omit-fix] Fix #22048 where we failed to drop rules for -fomit-interface-pragmas.

Andreas Klebinger (@AndreasK) gitlab at gitlab.haskell.org
Mon Aug 15 10:24:34 UTC 2022



Andreas Klebinger pushed to branch wip/andreask/rules-omit-fix at Glasgow Haskell Compiler / GHC


Commits:
1f2d7439 by Andreas Klebinger at 2022-08-15T12:24:12+02:00
Fix #22048 where we failed to drop rules for -fomit-interface-pragmas.

Now we also filter the local rules (again) which fixes the issue.

- - - - -


3 changed files:

- compiler/GHC/Iface/Tidy.hs
- + testsuite/tests/driver/T22048.hs
- testsuite/tests/driver/all.T


Changes:

=====================================
compiler/GHC/Iface/Tidy.hs
=====================================
@@ -2,6 +2,7 @@
 {-# LANGUAGE DeriveFunctor #-}
 
 {-# OPTIONS_GHC -Wno-incomplete-uni-patterns #-}
+{-# OPTIONS_GHC -Wno-incomplete-uni-patterns -ddump-simpl -ddump-to-file -O2 #-}
 {-# LANGUAGE NamedFieldPuns #-}
 
 {-
@@ -1048,7 +1049,8 @@ findExternalRules opts binds imp_id_rules unfold_env
             -- In needed_fvs', we don't bother to delete binders from the fv set
 
          local_rules  = [ rule
-                        | id <- bndrs
+                        | (opt_expose_rules opts)
+                        , id <- bndrs
                         , is_external_id id   -- Only collect rules for external Ids
                         , rule <- idCoreRules id
                         , expose_rule rule ]  -- and ones that can fire in a client


=====================================
testsuite/tests/driver/T22048.hs
=====================================
@@ -0,0 +1,11 @@
+module T22048 where
+
+{-# NOINLINE g #-}
+g :: Bool -> Bool
+g = not
+
+-- With -fomit-interface-pragmas these rules should not make it into interface files.
+{-# RULES
+"imported_rule"    [~1] forall xs. map g xs              = []
+"local_rule"       [~1] forall .   g True                = False
+#-}
\ No newline at end of file


=====================================
testsuite/tests/driver/all.T
=====================================
@@ -311,3 +311,4 @@ test('T20569', extra_files(["T20569/"]), makefile_test, [])
 test('T21866', normal, multimod_compile, ['T21866','-no-link'])
 test('T21349', extra_files(['T21349']), makefile_test, [])
 test('T21869', [normal, when(unregisterised(), skip)], makefile_test, [])
+test('T22048', [grep_errmsg("_rule")], compile, ["-fomit-interface-pragmas -ddump-simpl"])



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

-- 
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/1f2d74398ff7558d9d82de1c29b2068447bcc9dc
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/20220815/b4a452d3/attachment-0001.html>


More information about the ghc-commits mailing list