From a7176fa1bf42dd4f22381d238f6e65d76290887e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=96mer=20Sinan=20A=C4=9Facan?= Date: Fri, 12 Jul 2019 15:36:32 +0300 Subject: Minor refactoring in CmmBuildInfoTables - Replace `catMaybes (map ...)` with `mapMaybe ...` - Remove a list->set->list conversion --- compiler/cmm/CmmBuildInfoTables.hs | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/compiler/cmm/CmmBuildInfoTables.hs b/compiler/cmm/CmmBuildInfoTables.hs index 04b3d70f54..90d15aeea7 100644 --- a/compiler/cmm/CmmBuildInfoTables.hs +++ b/compiler/cmm/CmmBuildInfoTables.hs @@ -707,18 +707,16 @@ oneSRT dflags staticFuns blockids lbls isCAF cafs = do -- First resolve all the CAFLabels to SRTEntries -- Implements the [Inline] optimisation. - resolved = - Set.fromList $ - catMaybes (map (resolveCAF srtMap) (Set.toList nonRec)) + resolved = mapMaybe (resolveCAF srtMap) (Set.toList nonRec) -- The set of all SRTEntries in SRTs that we refer to from here. allBelow = - Set.unions [ lbls | caf <- Set.toList resolved + Set.unions [ lbls | caf <- resolved , Just lbls <- [Map.lookup caf (flatSRTs topSRT)] ] -- Remove SRTEntries that are also in an SRT that we refer to. -- Implements the [Filter] optimisation. - filtered = Set.difference resolved allBelow + filtered = Set.difference (Set.fromList resolved) allBelow srtTrace "oneSRT:" (ppr cafs <+> ppr resolved <+> ppr allBelow <+> ppr filtered) $ return () -- cgit v1.2.1