dead load/store elimination
parent
d1a7708d21
commit
5648b40a16
|
@ -51,7 +51,6 @@
|
||||||
- remove dead code after a 'throw'
|
- remove dead code after a 'throw'
|
||||||
- when doing comparison with one arg being a float, inline method
|
- when doing comparison with one arg being a float, inline method
|
||||||
- investigate overzealous math inlining
|
- investigate overzealous math inlining
|
||||||
- literals on either side of a shuffle can be more efficient
|
|
||||||
- shuffles: eliminate dead loads
|
- shuffles: eliminate dead loads
|
||||||
- floating point intrinsics
|
- floating point intrinsics
|
||||||
- flushing optimization
|
- flushing optimization
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
IN: inference
|
IN: inference
|
||||||
USING: kernel math namespaces sequences ;
|
USING: hashtables kernel math namespaces sequences ;
|
||||||
|
|
||||||
TUPLE: shuffle in-d in-r out-d out-r ;
|
TUPLE: shuffle in-d in-r out-d out-r ;
|
||||||
|
|
||||||
|
@ -11,7 +11,7 @@ TUPLE: shuffle in-d in-r out-d out-r ;
|
||||||
tuck shuffle-in-r [ set ] 2each shuffle-in-d [ set ] 2each ;
|
tuck shuffle-in-r [ set ] 2each shuffle-in-d [ set ] 2each ;
|
||||||
|
|
||||||
: shuffled-values ( values -- values )
|
: shuffled-values ( values -- values )
|
||||||
[ dup literal? [ get ] unless ] map ;
|
[ [ namespace hash dup ] keep ? ] map ;
|
||||||
|
|
||||||
: store-shuffle ( shuffle -- d r )
|
: store-shuffle ( shuffle -- d r )
|
||||||
dup shuffle-out-d shuffled-values
|
dup shuffle-out-d shuffled-values
|
||||||
|
|
|
@ -3,20 +3,36 @@ USING: assembler compiler compiler-backend generic inference
|
||||||
kernel kernel-internals lists math prettyprint sequences strings
|
kernel kernel-internals lists math prettyprint sequences strings
|
||||||
test vectors words ;
|
test vectors words ;
|
||||||
|
|
||||||
! Some dataflow tests
|
: kill-1
|
||||||
! [ 3 ] [ 1 2 3 (subst-value) ] unit-test
|
[ 1 2 3 ] [ + ] over drop drop ; compiled
|
||||||
! [ 1 ] [ 1 2 2 (subst-value) ] unit-test
|
|
||||||
!
|
[ [ 1 2 3 ] ] [ kill-1 ] unit-test
|
||||||
! [ { "one" "one" "three" "three" } ]
|
|
||||||
! [
|
: kill-2
|
||||||
! { "one" "two" "three" } { 1 2 3 } { 1 1 3 3 }
|
[ + ] [ 1 2 3 ] over drop nip ; compiled
|
||||||
! clone [ (subst-values) ] keep
|
|
||||||
! ] unit-test
|
[ [ 1 2 3 ] ] [ kill-2 ] unit-test
|
||||||
!
|
|
||||||
! [ << meet f { "one" 2 3 } >> ]
|
: kill-3
|
||||||
! [ "one" 1 << meet f { 1 2 3 } >> clone (subst-value) ] unit-test
|
[ + ] dup over 3drop ;
|
||||||
|
|
||||||
|
[ ] [ kill-3 ] unit-test
|
||||||
|
|
||||||
|
: kill-4
|
||||||
|
[ 1 2 3 ] [ + ] [ - ] pick >r 2drop r> ; compiled
|
||||||
|
|
||||||
|
[ [ 1 2 3 ] [ 1 2 3 ] ] [ kill-4 ] unit-test
|
||||||
|
|
||||||
|
: kill-5
|
||||||
|
[ + ] [ - ] [ 1 2 3 ] pick pick 2drop >r 2drop r> ; compiled
|
||||||
|
|
||||||
|
[ [ 1 2 3 ] ] [ kill-5 ] unit-test
|
||||||
|
|
||||||
|
: kill-6
|
||||||
|
[ 1 2 3 ] [ 4 5 6 ] [ + ] pick >r drop r> ; compiled
|
||||||
|
|
||||||
|
[ [ 1 2 3 ] [ 4 5 6 ] [ 1 2 3 ] ] [ kill-6 ] unit-test
|
||||||
|
|
||||||
! Literal kill tests
|
|
||||||
: kill-set*
|
: kill-set*
|
||||||
dataflow kill-set [ literal-value ] map ;
|
dataflow kill-set [ literal-value ] map ;
|
||||||
|
|
||||||
|
|
|
@ -1,10 +1,5 @@
|
||||||
IN: temporary
|
IN: temporary
|
||||||
USE: compiler
|
USING: compiler kernel math-internals test ;
|
||||||
USE: test
|
|
||||||
USE: words
|
|
||||||
USE: lists
|
|
||||||
USE: math
|
|
||||||
USE: kernel
|
|
||||||
|
|
||||||
! Test shuffle intrinsics
|
! Test shuffle intrinsics
|
||||||
[ ] [ 1 [ drop ] compile-1 ] unit-test
|
[ ] [ 1 [ drop ] compile-1 ] unit-test
|
||||||
|
@ -24,34 +19,5 @@ USE: kernel
|
||||||
[ 1 2 3 1 ] [ 1 2 3 [ pick ] compile-1 ] unit-test
|
[ 1 2 3 1 ] [ 1 2 3 [ pick ] compile-1 ] unit-test
|
||||||
[ 2 1 ] [ 1 2 [ swap ] compile-1 ] unit-test
|
[ 2 1 ] [ 1 2 [ swap ] compile-1 ] unit-test
|
||||||
|
|
||||||
! Test various kill combinations
|
! Test literals in either side of a shuffle
|
||||||
|
[ 4 1 ] [ 1 [ [ 3 fixnum+ ] keep ] compile-1 ] unit-test
|
||||||
: kill-1
|
|
||||||
[ 1 2 3 ] [ + ] over drop drop ; compiled
|
|
||||||
|
|
||||||
[ [ 1 2 3 ] ] [ kill-1 ] unit-test
|
|
||||||
|
|
||||||
: kill-2
|
|
||||||
[ + ] [ 1 2 3 ] over drop nip ; compiled
|
|
||||||
|
|
||||||
[ [ 1 2 3 ] ] [ kill-2 ] unit-test
|
|
||||||
|
|
||||||
: kill-3
|
|
||||||
[ + ] dup over 3drop ;
|
|
||||||
|
|
||||||
[ ] [ kill-3 ] unit-test
|
|
||||||
|
|
||||||
: kill-4
|
|
||||||
[ 1 2 3 ] [ + ] [ - ] pick >r 2drop r> ; compiled
|
|
||||||
|
|
||||||
[ [ 1 2 3 ] [ 1 2 3 ] ] [ kill-4 ] unit-test
|
|
||||||
|
|
||||||
: kill-5
|
|
||||||
[ + ] [ - ] [ 1 2 3 ] pick pick 2drop >r 2drop r> ; compiled
|
|
||||||
|
|
||||||
[ [ 1 2 3 ] ] [ kill-5 ] unit-test
|
|
||||||
|
|
||||||
: kill-6
|
|
||||||
[ 1 2 3 ] [ 4 5 6 ] [ + ] pick >r drop r> ; compiled
|
|
||||||
|
|
||||||
[ [ 1 2 3 ] [ 4 5 6 ] [ 1 2 3 ] ] [ kill-6 ] unit-test
|
|
||||||
|
|
Loading…
Reference in New Issue