-fignore-interface-pragmas doesn't work well with --make
Interfaces files are currently only read once but how they are read depends on
-fignore-interface-pragmas. If the flag is
turned on then the files are read without pragma information (unfolding info, rules, demand info and so on). This causes
--make, if a later module is compiled with optimisation and requires the same interface file because it has already been loaded and stripped -- during optimization imported identifiers will not have pragma info and so optimisation decisions will be
There are quite a few tickets reporting this, this ticket tracks progress to fixing them all: #13002, #12847 (closed), #9370, #8635, #20021
The proposed solution is to always read pragma information from an interface file and then decide at the use site whether to make use of it or not.
There are the currently serialised pragmas:
data IfaceInfoItem = HsArity Arity | HsDmdSig DmdSig | HsCprSig CprSig | HsInline InlinePragma | HsUnfold Bool -- True <=> isStrongLoopBreaker is true IfaceUnfolding -- See Note [Expose recursive functions] | HsNoCafRefs | HsLevity -- Present <=> never representation-polymorphic | HsLFInfo IfaceLFInf
The other place the flag takes effect is when deserialising
The current iteration of this/per proposed approach is at !6080. We always read all info from an interface file but then only guard the use sites of
RULES pragmas. This prevents cross-module inlining and cross-module rule firings. Reading the other pragmas seems to have a generally positive effect on compile-time.