X-Git-Url: https://git.stderr.nl/gitweb?a=blobdiff_plain;f=c%CE%BBash%2FCLasH%2FNormalize.hs;h=e69db2c4421c0f018bfab8a1aac78fc0a4c91ac3;hb=04de89474351850ea9dca0350fa383f1b2aff8ea;hp=6096c65bb3c59bbc2105726b54c0d178587fce0c;hpb=cb6549978b8d8d360efcfc7586ca75f4442c2c57;p=matthijs%2Fmaster-project%2Fc%CE%BBash.git diff --git "a/c\316\273ash/CLasH/Normalize.hs" "b/c\316\273ash/CLasH/Normalize.hs" index 6096c65..e69db2c 100644 --- "a/c\316\273ash/CLasH/Normalize.hs" +++ "b/c\316\273ash/CLasH/Normalize.hs" @@ -102,10 +102,11 @@ letrectop = everywhere ("letrec", letrec) -------------------------------- letsimpl, letsimpltop :: Transform -- Put the "in ..." value of a let in its own binding, but not when the --- expression is applicable (to prevent loops with inlinefun). -letsimpl expr@(Let (Rec binds) res) | not $ is_applicable expr = do +-- expression is already a local variable, or not representable (to prevent loops with inlinenonrep). +letsimpl expr@(Let (Rec binds) res) = do + repr <- isRepr res local_var <- Trans.lift $ is_local_var res - if not local_var + if not local_var && repr then do -- If the result is not a local var already (to prevent loops with -- ourselves), extract it.