Simon Jakobi pushed to branch wip/sjakobi/udfm-placement at Glasgow Haskell Compiler / GHC

Commits:

1 changed file:

Changes:

  • compiler/GHC/Types/Unique/DFM.hs
    ... ... @@ -504,12 +504,13 @@ udfmRestrictKeysSet (UDFM val_set i) set =
    504 504
     -- as this already incurs most of the cost of returning the full list.
    
    505 505
     -- See Note [Cost of deterministic iteration].
    
    506 506
     udfmToList :: UniqDFM key elt -> [(Unique, elt)]
    
    507
    -{-# INLINE udfmToList #-}  -- so the small case is a good producer
    
    507
    +-- NB: no INLINE, unlike eltsUDFM. udfmToList's one hot consumer is
    
    508
    +-- traverseUSDFM in the pattern-match checker, which doesn't fuse. Inlining
    
    509
    +-- the size dispatch into it regresses T17836.
    
    508 510
     udfmToList (UDFM m ub)
    
    509 511
       -- n <= 1: any order is trivially tag order, so read straight off the map
    
    510 512
       | M.compareSize m 1 /= GT =
    
    511
    -      build (\c n ->
    
    512
    -        M.foldrWithKey (\k tv r -> c (mkUniqueGrimily k, taggedFst tv) r) n m)
    
    513
    +      M.foldrWithKey (\k tv r -> (mkUniqueGrimily k, taggedFst tv) : r) [] m
    
    513 514
       | otherwise = to_list_nonempty m ub
    
    514 515
     
    
    515 516
     -- Precondition: m is non-empty