Skip to content

Commit

Permalink
Merge pull request #121 from Z-snails/fix-arity-raising
Browse files Browse the repository at this point in the history
Don't arity raise or unbox `grinMain`
  • Loading branch information
andorp committed May 28, 2021
2 parents 280dfeb + 6de88bc commit 2135fe5
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
1 change: 1 addition & 0 deletions grin/src/Transformations/Optimising/ArityRaising.hs
Expand Up @@ -103,6 +103,7 @@ phase1 te = pdArityData . cata collect where
, isJust mtag
, p `notElem` (bdOther body)
, p `notElem` (snd <$> (filter ((/=fn) . fst) (bdFunCall body)))
, fn /= "grinMain"
]
in FunData $ case funData of
[] -> Map.empty
Expand Down
2 changes: 1 addition & 1 deletion grin/src/Transformations/Optimising/GeneralizedUnboxing.hs
Expand Up @@ -92,7 +92,7 @@ functionsToUnbox te (Program exts defs) = result where

nonCandidateTailCallMap = Map.withoutKeys tranisitiveTailCalls result0
candidateCalledByNonCandidate = (Set.unions $ Map.elems nonCandidateTailCallMap) `Set.intersection` result0
result = result0 `Set.difference` candidateCalledByNonCandidate
result = Set.delete "grinMain" $ result0 `Set.difference` candidateCalledByNonCandidate

result0 = Set.fromList $ step initial
initial = map funName $ filter (doesReturnAKnownProduct te . funName) defs
Expand Down

0 comments on commit 2135fe5

Please sign in to comment.