From 43ff61950ef701fc7d6e8308fa7c5256f82f8dc5 Mon Sep 17 00:00:00 2001 From: simonmar Date: Wed, 17 Oct 2001 14:17:11 +0000 Subject: [PATCH] [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. --- ghc/compiler/simplCore/SimplUtils.lhs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) 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) -- 1.7.10.4