~ chicken-core (chicken-5) 800fff56e8e8c95316154e14648b69fc632c4f0b


commit 800fff56e8e8c95316154e14648b69fc632c4f0b
Author:     Evan Hanson <evhan@foldling.org>
AuthorDate: Wed May 27 20:25:33 2015 +1200
Commit:     Peter Bex <peter@more-magic.net>
CommitDate: Sat May 30 16:29:47 2015 +0200

    Add test case that triggers clustering
    
    Signed-off-by: Peter Bex <peter@more-magic.net>

diff --git a/distribution/manifest b/distribution/manifest
index 6e1dcc50..1493bda4 100644
--- a/distribution/manifest
+++ b/distribution/manifest
@@ -94,6 +94,7 @@ build-version.scm
 build-version.c
 buildid
 buildtag.h
+tests/clustering-tests.scm
 tests/data-structures-tests.scm
 tests/environment-tests.scm
 tests/gobble.scm
diff --git a/tests/clustering-tests.scm b/tests/clustering-tests.scm
new file mode 100644
index 00000000..92fec92f
--- /dev/null
+++ b/tests/clustering-tests.scm
@@ -0,0 +1,7 @@
+;;; clustering-tests.scm
+
+;; triggers `determine-loop-and-dispatch`
+(let ()
+  (define (a x) (if (= x 0) x (b (sub1 x))))
+  (define (b x) (if (= x 0) x (a (sub1 x))))
+  (a 10))
diff --git a/tests/runtests.bat b/tests/runtests.bat
index e94fd102..1405b0e4 100644
--- a/tests/runtests.bat
+++ b/tests/runtests.bat
@@ -36,6 +36,12 @@ if errorlevel 1 exit /b 1
 a.out
 if errorlevel 1 exit /b 1
 
+echo ======================================== optimizer tests  ...
+%compile% clustering-tests.scm -clustering
+if errorlevel 1 exit /b 1
+a.out
+if errorlevel 1 exit /b 1
+
 echo ======================================== scrutiny tests ...
 %compile% typematch-tests.scm -specialize -w
 if errorlevel 1 exit /b 1
diff --git a/tests/runtests.sh b/tests/runtests.sh
index 7bf282ef..1af81556 100755
--- a/tests/runtests.sh
+++ b/tests/runtests.sh
@@ -81,6 +81,10 @@ echo "======================================== compiler inlining tests  ..."
 $compile inlining-tests.scm -optimize-level 3
 ./a.out
 
+echo "======================================== optimizer tests  ..."
+$compile clustering-tests.scm -clustering
+./a.out
+
 echo "======================================== scrutiny tests ..."
 $compile typematch-tests.scm -specialize -w
 ./a.out
Trap