]> gitweb.factorcode.org Git - factor.git/commitdiff
cleanup pass didn't properly handle conditionals where both branches were dead
authorSlava Pestov <slava@slava-pestovs-macbook-pro.local>
Tue, 11 Nov 2008 14:38:03 +0000 (08:38 -0600)
committerSlava Pestov <slava@slava-pestovs-macbook-pro.local>
Tue, 11 Nov 2008 14:38:03 +0000 (08:38 -0600)
basis/compiler/tree/cleanup/cleanup-tests.factor
basis/compiler/tree/cleanup/cleanup.factor

index b77a27800fa285404e33c0a5d2eaf985fd4401b4..13847e55a214d92d454d290ce9b98b6f47ee2dc6 100644 (file)
@@ -500,3 +500,8 @@ cell-bits 32 = [
     [ { array-capacity } declare 1 fixnum+ ] cleaned-up-tree
     [ { [ #call? ] [ node-input-infos second literal>> 1 = ] } 1&& ] contains?
 ] unit-test
+
+[ ] [
+    [ { null } declare [ 1 ] [ 2 ] if ]
+    build-tree normalize propagate cleanup check-nodes
+] unit-test
index 4ca058b2e393bdaef2f07ab46aaa572bd36b58dd..becac01cd5355a957e857d47849dc68c912c71e4 100644 (file)
@@ -102,7 +102,7 @@ M: #declare cleanup* drop f ;
     #! If only one branch is live we don't need to branch at
     #! all; just drop the condition value.
     dup live-children sift dup length {
-        { 0 [ 2drop f ] }
+        { 0 [ drop in-d>> #drop ] }
         { 1 [ first swap in-d>> #drop prefix ] }
         [ 2drop ]
     } case ;