simonpj     2005/10/17 04:10:36 PDT

  Modified files:
    ghc/compiler/simplCore SimplUtils.lhs 
  Log:
        Small simplifier bug in case optimisation
        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  
  The simplifier eliminates redundant case branches, and panics if there
  are no case alternatives.  But due to a slightly delayed instantiation
  of a type constructor variable 'p' by a type constructor 'P', it turned
  out that an inner case had no alternatives at all, becuase an outer case
  had not pruned a branch as quickly as it should have.
  
  This commit fixes both problems:
  
  a) SimplUtils.mkCase1 now returns a call to 'error' (instead of panicing)
     when it gets an empty list of alternatives.   Somewhat analogous to
     the inaccessible GADT case in Simplify.simplifyAlt
  
  b) In SimplUtils.prepareDefault, use the up-to-date scrutinee, rather than
     the less up-to-date case_bndr, to get the case type constructor.  That
     leads to slightly earlier pruning of inaccessible branches.
  
  Fixes a bug reported by Ian Lynagh.
  
  Test is simplCore/should_compile/simpl013
  
  Revision  Changes    Path
  1.105     +18 -10    fptools/ghc/compiler/simplCore/SimplUtils.lhs
_______________________________________________
Cvs-ghc mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/cvs-ghc

Reply via email to