cleanup pass didn't properly handle conditionals where both branches were dead
parent
43335d9c36
commit
7f9fbdaa4e
basis/compiler/tree/cleanup
|
@ -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
|
||||
|
|
|
@ -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 ;
|
||||
|
|
Loading…
Reference in New Issue