id,summary,reporter,owner,description,type,status,priority,milestone,component,version,resolution,keywords,cc,os,architecture,failure,difficulty,testcase,blockedby,blocking,related
4960,Better inlining test in CoreUnfold,simonpj,,"Consider this
{{{
f x = let 
        $j y = case x of { True -> e1; False -> e2 }
      in
      case x of 
        True -> ...$j y1...
        False -> ...$j y2...
}}}
If a function that scrutinises its argument is applied to a constructor, it becomes much keener to inline.  But in this example the function scrutinises a ''free variable'' that is evaluated to a known constructor at the call site.  At the moment this is ignored, and `$j` may well not be inlined in situations where it would be jolly good to do so.

This shows up in test `perf/should_run/MethSharing` where the join points created early only inline because `exprIsDupable` is ''just'' generous enough to do so.  If you reduce `CoreUtils.dupAppSize` by 1, the join point doesn't inline any more.  But it should.

The solution is fairly easy: compute discounts on free varaibles as well as arguments.  I'm making a ticket because I don't want to execute on this today.",bug,new,low,7.6.2,Compiler,7.0.1,,,,Unknown/Multiple,Unknown/Multiple,None/Unknown,,,,,
