• simonpj@microsoft.com's avatar
    Improve SpecConstr for local bindings: seed specialisation from the calls · e5adcaf8
    simonpj@microsoft.com authored
    This patch makes a significant improvement to SpecConstr, based on
    Roman's experience with using it for stream fusion.  The main change is
    this:
    
      * For local (not-top-level) declarations, seed the specialisation 
        loop from the calls in the body of the 'let'.
    
    See Note [Local recursive groups] for discussion and example.  Top-level
    declarations are treated just as before.
    
    Other changes in this patch:
    
      * New flag -fspec-constr-count=N sets the maximum number of specialisations
        for any single function to N.  -fno-spec-constr-count removes the limit.
    
      * Refactoring in specLoop and friends; new algebraic data types 
        OneSpec and SpecInfo instead of the tuples that were there before
    
      * Be less keen to specialise on variables that are simply in scope.
        Example
          f p q = letrec g a y = ...g....  in g q p
        We probably do not want to specialise 'g' for calls with exactly
        the arguments 'q' and 'p', since we know nothing about them.
    
    e5adcaf8
DynFlags.hs 65 KB