Make top level inlining handle non-representable results gracefully.
authorMatthijs Kooijman <matthijs@stdin.nl>
Tue, 6 Apr 2010 17:44:57 +0000 (19:44 +0200)
committerMatthijs Kooijman <matthijs@stdin.nl>
Tue, 6 Apr 2010 17:44:57 +0000 (19:44 +0200)
Since it does not know (nor care) if the function result is
representable, it now uses splitNormalizedNonRep and checks if the
result is a Var afterwards.

cλash/CLasH/Normalize.hs

index 8e6926aa7c4d4ac59b3f159e690a1bee58ffb634..620482f703547f65f3dff7eb888742f70e67421d 100644 (file)
@@ -358,10 +358,10 @@ needsInline f = do
         case norm_maybe of
           -- Noth normalizeable
           Nothing -> return Nothing 
-          Just norm -> case splitNormalized norm of
+          Just norm -> case splitNormalizedNonRep norm of
             -- The function has just a single binding, so that's simple
             -- enough to inline.
-            (args, [bind], res) -> return $ Just norm
+            (args, [bind], Var res) -> return $ Just norm
             -- More complicated function, don't inline
             _ -> return Nothing