let { (binds', counts') = initSmpl sw_chkr us1 imported_rule_ids
black_list_fn
(simplTopBinds tagged_binds);
+ -- The imported_rule_ids are used by initSmpl to initialise
+ -- the in-scope set. That way, the simplifier will change any
+ -- occurrences of the imported id to the one in the imported_rule_ids
+ -- set, which are decorated with their rules.
+
all_counts = counts `plusSimplCount` counts'
} ;
-- Stop if we've run out of iterations
if iteration_no == max_iterations then
do {
+#ifdef DEBUG
if max_iterations > 2 then
hPutStr stderr ("NOTE: Simplifier still going after " ++
show max_iterations ++
" iterations; bailing out.\n")
- else return ();
+ else
+#endif
+ return ();
return ("Simplifier baled out", iteration_no, all_counts, binds')
}
returnPM (Let bind' body')
postSimplExpr (Note note body)
- = postSimplExprEta body `thenPM` \ body' ->
+ = postSimplExpr body `thenPM` \ body' ->
+ -- Do *not* call postSimplExprEta here
+ -- We don't want to turn f = \x -> coerce t (\y -> f x y)
+ -- into f = \x -> coerce t (f x)
+ -- because then f has a lower arity.
+ -- This is not only bad in general, it causes the arity to
+ -- not match the [Demand] on an Id,
+ -- which confuses the importer of this module.
returnPM (Note note body')
postSimplExpr (Case scrut case_bndr alts)
litToRep (NoRepInteger i integer_ty)
= returnPM (integer_ty, rhs)
where
- rhs | i > tARGET_MIN_INT && -- Small enough, so start from an Int
- i < tARGET_MAX_INT
+ rhs | i >= tARGET_MIN_INT && -- Small enough, so start from an Int
+ i <= tARGET_MAX_INT
= Con (DataCon smallIntegerDataCon) [Con (Literal (mkMachInt i)) []]
| otherwise -- Big, so start from a string