From: simonmar Date: Wed, 17 Oct 2001 14:17:11 +0000 (+0000) Subject: [project @ 2001-10-17 14:17:11 by simonmar] X-Git-Tag: Approximately_9120_patches~810 X-Git-Url: http://git.megacz.com/?a=commitdiff_plain;h=43ff61950ef701fc7d6e8308fa7c5256f82f8dc5;p=ghc-hetmet.git [project @ 2001-10-17 14:17:11 by simonmar] Fix a small performance bug. In mkAlts, when calculating the impossible constructors, we were looking at the unfolding for the case binder instead of the scrutinee, with the result that we sometimes didn't notice that a DEFAULT case could be resolved into a specific pattern. --- diff --git a/ghc/compiler/simplCore/SimplUtils.lhs b/ghc/compiler/simplCore/SimplUtils.lhs index 1dd3ea1..906568b 100644 --- a/ghc/compiler/simplCore/SimplUtils.lhs +++ b/ghc/compiler/simplCore/SimplUtils.lhs @@ -910,7 +910,9 @@ mkAlts scrut case_bndr alts in returnSmpl better_alts where - impossible_cons = otherCons (idUnfolding case_bndr) + impossible_cons = case scrut of + Var v -> otherCons (idUnfolding v) + other -> [] handled_data_cons = [data_con | DataAlt data_con <- impossible_cons] ++ [data_con | (DataAlt data_con, _, _) <- alts] is_missing con = not (con `elem` handled_data_cons)