From 4aed809f270a2a01cfaca05381c0689cd881556b Mon Sep 17 00:00:00 2001
From: Matthijs Kooijman <m.kooijman@student.utwente.nl>
Date: Wed, 19 Aug 2009 14:42:58 +0200
Subject: [PATCH] When inlining top level functions, guarantee uniqueness.

---
 "c\316\273ash/CLasH/Normalize.hs" | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git "a/c\316\273ash/CLasH/Normalize.hs" "b/c\316\273ash/CLasH/Normalize.hs"
index cce3186..1f0509d 100644
--- "a/c\316\273ash/CLasH/Normalize.hs"
+++ "b/c\316\273ash/CLasH/Normalize.hs"
@@ -332,8 +332,10 @@ inlinetoplevel expr@(Var f) | not $ isUserDefined f = do
       -- Get the normalized version
       norm <- Trans.lift $ getNormalized f
       if needsInline norm 
-        then
-          change norm
+        then do
+          -- Regenerate all uniques in the to-be-inlined expression
+          norm_uniqued <- Trans.lift $ genUniques norm
+          change norm_uniqued
         else
           return expr
     else
-- 
2.30.2