Load the interface details for GHC.* even without -O
Neil says: I just tried compiling the following program:
foo = (1 :: Int) == (2 :: Int)
with ghc --ddump-simpl
, and no optimisation flags, in GHC 6.6.1
The resultant code is:
Test.foo =
case GHC.Base.$f2 of tpl_X8 { GHC.Base.:DEq tpl1_B2 tpl2_B3 ->
tpl1_B2 (GHC.Base.I# 1) (GHC.Base.I# 2)
}
GHC has introduced dictionaries in this example. In comparison, Yhc and nhc wouldn't introduce dictionaries here, as the type class desugaring knows the type of the item is fixed, and makes a direct call to the appropriate function.
If the desugaring was changed, it would make programs in GHCi run faster, would reduce the size of programs, and would speed up the optimiser, as it would have less to do. I am not sure how much additional work this would require in the simplifier, but if it was minimal, the gains would probably be worth it.
The reason nothing happens is that without -0 GHC does not load the unfoldings for anything from interface files, including GHC.Base
. Idea: even without -O, load the unfoldings from GHC.* modules. That would pick up a lot of very fundamental stuff, and might, as Neil says, make compilation faster.
Relatively easy to try. But would need a good nofib run to test the effects. Any takers? I'd point you at what to change.
Simon
Trac metadata
Trac field | Value |
---|---|
Version | 6.8.2 |
Type | FeatureRequest |
TypeOfFailure | OtherFailure |
Priority | normal |
Resolution | Unresolved |
Component | Compiler |
Test case | |
Differential revisions | |
BlockedBy | |
Related | |
Blocking | |
CC | |
Operating system | Unknown |
Architecture | Unknown |