summaryrefslogtreecommitdiff
path: root/compiler/GHC/Cmm/Sink.hs
diff options
context:
space:
mode:
authorBen Gamari <ben@smart-cactus.org>2021-10-12 20:46:32 -0400
committerBen Gamari <ben@smart-cactus.org>2022-08-06 11:45:17 -0400
commitc0348865ff8b9100a8ec54be03e375c3dddc8900 (patch)
tree72196c15585254eb672b787e04bf6d01144f9adc /compiler/GHC/Cmm/Sink.hs
parentf8bec4e37827bc8ff77a00773692fea4e7193af4 (diff)
downloadhaskell-c0348865ff8b9100a8ec54be03e375c3dddc8900.tar.gz
compiler: Eliminate two uses of foldr in favor of foldl'
These two uses constructed maps, which is a case where foldl' is generally more efficient since we avoid constructing an intermediate O(n)-depth stack.
Diffstat (limited to 'compiler/GHC/Cmm/Sink.hs')
-rw-r--r--compiler/GHC/Cmm/Sink.hs2
1 files changed, 1 insertions, 1 deletions
diff --git a/compiler/GHC/Cmm/Sink.hs b/compiler/GHC/Cmm/Sink.hs
index 84f9317f21..68b20fd307 100644
--- a/compiler/GHC/Cmm/Sink.hs
+++ b/compiler/GHC/Cmm/Sink.hs
@@ -268,7 +268,7 @@ findJoinPoints blocks = mapFilter (>1) succ_counts
all_succs = concatMap successors blocks
succ_counts :: LabelMap Int
- succ_counts = foldr (\l -> mapInsertWith (+) l 1) mapEmpty all_succs
+ succ_counts = foldl' (\acc l -> mapInsertWith (+) l 1 acc) mapEmpty all_succs
--
-- filter the list of assignments to remove any assignments that