X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=compiler%2FnativeGen%2FGraphOps.hs;h=308cae0467afe43d0c144f2eb997da61dc6b797c;hb=8672676c20d5c9a268a8f07dc7aa706df4ca315f;hp=f620d8a0dfb5a266e5d4676388adbd353db7abd2;hpb=272f0ba89eca1d9fc700cf4c27b9f8c3e23d6fe8;p=ghc-hetmet.git diff --git a/compiler/nativeGen/GraphOps.hs b/compiler/nativeGen/GraphOps.hs index f620d8a..308cae0 100644 --- a/compiler/nativeGen/GraphOps.hs +++ b/compiler/nativeGen/GraphOps.hs @@ -28,7 +28,6 @@ import UniqFM import Data.List hiding (union) import Data.Maybe - -- | Lookup a node from the graph. lookupNode :: Uniquable k @@ -188,13 +187,13 @@ addConflicts conflicts getClass | otherwise = graphMapModify - $ (\fm -> foldr (\u -> addConflictSet1 u getClass conflicts) fm + $ (\fm -> foldl' (\g u -> addConflictSet1 u getClass conflicts g) fm $ uniqSetToList conflicts) addConflictSet1 u getClass set - = let set' = delOneFromUniqSet set u - in adjustWithDefaultUFM + = case delOneFromUniqSet set u of + set' -> adjustWithDefaultUFM (\node -> node { nodeConflicts = unionUniqSets set' (nodeConflicts node) } ) (newNode u (getClass u)) { nodeConflicts = set' } u @@ -447,6 +446,7 @@ setColor u color u +{-# INLINE adjustWithDefaultUFM #-} adjustWithDefaultUFM :: Uniquable k => (a -> a) -> a -> k @@ -458,7 +458,7 @@ adjustWithDefaultUFM f def k map map k def - +{-# INLINE adjustUFM #-} adjustUFM :: Uniquable k => (a -> a) @@ -468,5 +468,4 @@ adjustUFM f k map = case lookupUFM map k of Nothing -> map Just a -> addToUFM map k (f a) -