Adding identity to propagation to remove some redundant bitands
parent
3179dacb3e
commit
eb31589092
|
@ -899,3 +899,6 @@ M: tuple-with-read-only-slot clone
|
||||||
! We want this to inline
|
! We want this to inline
|
||||||
[ t ] [ [ void* <c-direct-array> ] { <c-direct-array> } inlined? ] unit-test
|
[ t ] [ [ void* <c-direct-array> ] { <c-direct-array> } inlined? ] unit-test
|
||||||
[ V{ void*-array } ] [ [ void* <c-direct-array> ] final-classes ] unit-test
|
[ V{ void*-array } ] [ [ void* <c-direct-array> ] final-classes ] unit-test
|
||||||
|
|
||||||
|
[ t ] [ [ alien-unsigned-1 255 bitand ] { bitand fixnum-bitand } inlined? ] unit-test
|
||||||
|
[ t ] [ [ alien-unsigned-1 255 swap bitand ] { bitand fixnum-bitand } inlined? ] unit-test
|
||||||
|
|
|
@ -45,6 +45,14 @@ IN: compiler.tree.propagation.transforms
|
||||||
: simplify-bitand? ( value -- ? )
|
: simplify-bitand? ( value -- ? )
|
||||||
value-info literal>> positive-fixnum? ;
|
value-info literal>> positive-fixnum? ;
|
||||||
|
|
||||||
|
: redundant-bitand? ( var 111... -- ? )
|
||||||
|
[ value-info ] bi@ { [
|
||||||
|
nip literal>>
|
||||||
|
{ [ positive-fixnum? ] [ dup 1 + bitand zero? ] } 1&&
|
||||||
|
] [
|
||||||
|
[ interval>> ] [ literal>> ] bi* 0 swap [a,b] interval-subset?
|
||||||
|
] } 2&& ;
|
||||||
|
|
||||||
{
|
{
|
||||||
bitand-integer-integer
|
bitand-integer-integer
|
||||||
bitand-integer-fixnum
|
bitand-integer-fixnum
|
||||||
|
@ -53,6 +61,14 @@ IN: compiler.tree.propagation.transforms
|
||||||
} [
|
} [
|
||||||
[
|
[
|
||||||
{
|
{
|
||||||
|
{
|
||||||
|
[ dup in-d>> first2 redundant-bitand? ]
|
||||||
|
[ drop [ drop ] ]
|
||||||
|
}
|
||||||
|
{
|
||||||
|
[ dup in-d>> first2 swap redundant-bitand? ]
|
||||||
|
[ drop [ nip ] ]
|
||||||
|
}
|
||||||
{
|
{
|
||||||
[ dup in-d>> first simplify-bitand? ]
|
[ dup in-d>> first simplify-bitand? ]
|
||||||
[ drop [ >fixnum fixnum-bitand ] ]
|
[ drop [ >fixnum fixnum-bitand ] ]
|
||||||
|
|
Loading…
Reference in New Issue