Define setIdUnfoldingLazily, and use it in Vectorise
authorIan Lynagh <igloo@earth.li>
Tue, 19 Oct 2010 20:15:37 +0000 (20:15 +0000)
committerIan Lynagh <igloo@earth.li>
Tue, 19 Oct 2010 20:15:37 +0000 (20:15 +0000)
Fixes a loop in the compiler, when running the dph tests

compiler/basicTypes/Id.lhs
compiler/vectorise/Vectorise.hs

index 3640693..d8771bc 100644 (file)
@@ -76,6 +76,7 @@ module Id (
        idOccInfo,
 
        -- ** Writing 'IdInfo' fields
+       setIdUnfoldingLazily,
        setIdUnfolding,
        setIdArity,
        setIdDemandInfo, 
@@ -119,7 +120,8 @@ import Util( count )
 import StaticFlags
 
 -- infixl so you can say (id `set` a `set` b)
-infixl         1 `setIdUnfolding`,
+infixl         1 `setIdUnfoldingLazily`,
+         `setIdUnfolding`,
          `setIdArity`,
          `setIdOccInfo`,
          `setIdDemandInfo`,
@@ -496,6 +498,9 @@ realIdUnfolding :: Id -> Unfolding
 -- Expose the unfolding if there is one, including for loop breakers
 realIdUnfolding id = unfoldingInfo (idInfo id)
 
+setIdUnfoldingLazily :: Id -> Unfolding -> Id
+setIdUnfoldingLazily id unfolding = modifyIdInfo (`setUnfoldingInfoLazily` unfolding) id
+
 setIdUnfolding :: Id -> Unfolding -> Id
 setIdUnfolding id unfolding = modifyIdInfo (`setUnfoldingInfo` unfolding) id
 
index 8e04833..223d88b 100644 (file)
@@ -168,7 +168,7 @@ vectTopBinder var inline expr
       vty  <- vectType (idType var)
 
       -- Make the vectorised version of binding's name, and set the unfolding used for inlining.
-      var' <- liftM (`setIdUnfolding` unfolding) 
+      var' <- liftM (`setIdUnfoldingLazily` unfolding) 
            $  cloneId mkVectOcc var vty
 
       -- Add the mapping between the plain and vectorised name to the state.