summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorÖmer Sinan Ağacan <omeragacan@gmail.com>2019-07-12 15:36:32 +0300
committerMarge Bot <ben+marge-bot@smart-cactus.org>2019-07-13 16:38:13 -0400
commita7176fa1bf42dd4f22381d238f6e65d76290887e (patch)
tree4c989e375ed9866addfa30dbd1922afb71bc76b4
parent232002c44942491759e44aa93a03a6bc68afbadf (diff)
downloadhaskell-a7176fa1bf42dd4f22381d238f6e65d76290887e.tar.gz
Minor refactoring in CmmBuildInfoTables
- Replace `catMaybes (map ...)` with `mapMaybe ...` - Remove a list->set->list conversion
-rw-r--r--compiler/cmm/CmmBuildInfoTables.hs8
1 files 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 ()