compiler.cfg.branch-splitting: re-enable with a better heuristic
parent
ff81b055a5
commit
d394dd3c36
|
@ -54,13 +54,31 @@ UNION: irrelevant ##peek ##replace ##inc-d ##inc-r ;
|
|||
|
||||
: split-instructions? ( insns -- ? ) [ irrelevant? not ] count 5 <= ;
|
||||
|
||||
: split-branch? ( bb -- ? )
|
||||
: short-tail-block? ( bb -- ? )
|
||||
[ successors>> empty? ] [ instructions>> length 2 = ] bi and ;
|
||||
|
||||
: short-block? ( bb -- ? )
|
||||
! If block is empty, always split
|
||||
[ predecessors>> length ] [ instructions>> length 1 - ] bi * 10 <= ;
|
||||
|
||||
: cond-cond-block? ( bb -- ? )
|
||||
{
|
||||
[ dup successors>> [ back-edge? ] with any? not ]
|
||||
[ predecessors>> length 2 4 between? ]
|
||||
[ instructions>> split-instructions? ]
|
||||
[ predecessors>> length 2 = ]
|
||||
[ successors>> length 2 = ]
|
||||
[ instructions>> length 20 <= ]
|
||||
} 1&& ;
|
||||
|
||||
: split-branch? ( bb -- ? )
|
||||
dup loop-entry? [ drop f ] [
|
||||
dup predecessors>> length 1 <= [ drop f ] [
|
||||
{
|
||||
[ short-block? ]
|
||||
[ short-tail-block? ]
|
||||
[ cond-cond-block? ]
|
||||
} 1||
|
||||
] if
|
||||
] if ;
|
||||
|
||||
: split-branches ( cfg -- cfg' )
|
||||
dup [
|
||||
dup split-branch? [ split-branch ] [ drop ] if
|
||||
|
|
|
@ -32,7 +32,7 @@ SYMBOL: check-optimizer?
|
|||
optimize-tail-calls
|
||||
delete-useless-conditionals
|
||||
compute-predecessors
|
||||
! split-branches
|
||||
split-branches
|
||||
join-blocks
|
||||
compute-predecessors
|
||||
construct-ssa
|
||||
|
|
Loading…
Reference in New Issue