reassoc: Propagate PHI_LOOP_BIAS along single uses
authorIlya Leoshkevich <iii@linux.ibm.com>
Tue, 23 Jun 2020 23:30:47 +0000 (01:30 +0200)
committerIlya Leoshkevich <iii@linux.ibm.com>
Tue, 28 Sep 2021 12:10:59 +0000 (14:10 +0200)
commitdbed1c8693c6b5cb02c903cea91db574200bd513
tree1351e1465d3e9cd4d27b1f8d79f1245d83cac6b5
parent99c106e695bd8f1de580c4ff0b1d3fe59c9a4f1e
reassoc: Propagate PHI_LOOP_BIAS along single uses

PR tree-optimization/49749 introduced code that shortens dependency
chains containing loop accumulators by placing them last on operand
lists of associative operations.

456.hmmer benchmark on s390 could benefit from this, however, the code
that needs it modifies loop accumulator before using it, and since only
so-called loop-carried phis are are treated as loop accumulators, the
code in the present form doesn't really help.   According to Bill
Schmidt - the original author - such a conservative approach was chosen
so as to avoid unnecessarily swapping operands, which might cause
unpredictable effects.  However, giving special treatment to forms of
loop accumulators is acceptable.

The definition of loop-carried phi is: it's a single-use phi, which is
used in the same innermost loop it's defined in, at least one argument
of which is defined in the same innermost loop as the phi itself.
Given this, it seems natural to treat single uses of such phis as phis
themselves.

gcc/ChangeLog:

* tree-ssa-reassoc.c (biased_names): New global.
(propagate_bias_p): New function.
(loop_carried_phi): Remove.
(propagate_rank): Propagate bias along single uses.
(get_rank): Update biased_names when needed.
gcc/tree-ssa-reassoc.c