[project @ 2001-10-17 14:17:11 by simonmar]
authorsimonmar <unknown>
Wed, 17 Oct 2001 14:17:11 +0000 (14:17 +0000)
committersimonmar <unknown>
Wed, 17 Oct 2001 14:17:11 +0000 (14:17 +0000)
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

index 1dd3ea1..906568b 100644 (file)
@@ -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)