Skip to content

Compute strictness signatures for idArity

Sebastian Graf requested to merge wip/dmd-arity into master

I think it would be helpful if we base our decisions on whether to use LetUp or LetDown and on which the incoming call demand is we put the expression under in demand analysis by looking at idArity.

This MR does four things:

  1. Look at idArity instead of manifest lambdas to decide whether to use LetUp
  2. Compute the strictness signature in LetDown assuming at least idArity incoming arguments
  3. Remove the special case for trivial RHSs, which is subsumed by 2.
  4. Don't perform the W/W split when doing so would eta expand a binding

Why would I want this? I'm preparing a patch to separate CprAnal off DmdAnal, but I hit a point where it gets annoying to make sure that the arity (i.e. "depth") of the CPR type always matches the arity of the demand type recorded in the StrictSig. Conceptually, I think it would be cleaner to have CoreArity determine the arity for which we provide signatures.

It also feels weird that we encode the arity at which to unleash demand signatures implicitly in the wrapped demand types depth, but that's for another time.

NoFib Results                                           
                                                        
--------------------------------------------------------------------------------                                
        Program         Allocs    Instrs                
--------------------------------------------------------------------------------                                
 fannkuch-redux          +0.3%      0.0%                
             gg          -0.0%     -0.1%                
       maillist          +0.2%     +0.2%                
        minimax           0.0%     +0.8%                
         pretty           0.0%     -0.1%                
            scc           0.0%     -0.1%                
--------------------------------------------------------------------------------                                
            Min          -0.0%     -0.1%                
            Max          +0.3%     +0.8%                
 Geometric Mean          +0.0%     +0.0%                                               
Edited by Sebastian Graf

Merge request reports