aboutsummaryrefslogtreecommitdiff
path: root/gcc/loop.c
diff options
context:
space:
mode:
authorMichael Hayes <m.hayes@elec.canterbury.ac.nz>1999-02-13 14:25:58 +0000
committerMichael Hayes <m.hayes@gcc.gnu.org>1999-02-13 14:25:58 +0000
commit77854601c25eb4c113895a5e2d993ed65e48bb37 (patch)
treec51b0dcea97d8e97c98a6e0be8cf36f60fb69e5f /gcc/loop.c
parent3c602fcbd2c7ea3f137735f5951d6e182092c052 (diff)
downloadgcc-77854601c25eb4c113895a5e2d993ed65e48bb37.zip
gcc-77854601c25eb4c113895a5e2d993ed65e48bb37.tar.gz
gcc-77854601c25eb4c113895a5e2d993ed65e48bb37.tar.bz2
loop.c (scan_loop): Call reg_in_basic_block_p before loop_reg_used_before_p.
* loop.c (scan_loop): Call reg_in_basic_block_p before loop_reg_used_before_p. From-SVN: r25182
Diffstat (limited to 'gcc/loop.c')
-rw-r--r--gcc/loop.c22
1 files changed, 14 insertions, 8 deletions
diff --git a/gcc/loop.c b/gcc/loop.c
index 12b52ad..9e230a6 100644
--- a/gcc/loop.c
+++ b/gcc/loop.c
@@ -851,17 +851,23 @@ scan_loop (loop_start, end, loop_cont, unroll_p, bct_p)
We don't know its life-span, so we can't compute the benefit. */
if (REGNO (SET_DEST (set)) >= max_reg_before_loop)
;
- else if (/* The set is not guaranteed to be executed one
- the loop starts, or the value before the set is
- needed before the set occurs... */
- (maybe_never
- || loop_reg_used_before_p (set, p, loop_start,
- scan_start, end))
- /* And the register is used in basic blocks other
+ else if (/* The register is used in basic blocks other
than the one where it is set (meaning that
something after this point in the loop might
depend on its value before the set). */
- && !reg_in_basic_block_p (p, SET_DEST (set)))
+ ! reg_in_basic_block_p (p, SET_DEST (set))
+ /* And the set is not guaranteed to be executed one
+ the loop starts, or the value before the set is
+ needed before the set occurs...
+
+ ??? Note we have quadratic behaviour here, mitigated
+ by the fact that the previous test will often fail for
+ large loops. Rather than re-scanning the entire loop
+ each time for register usage, we should build tables
+ of the register usage and use them here instead. */
+ && (maybe_never
+ || loop_reg_used_before_p (set, p, loop_start,
+ scan_start, end)))
/* It is unsafe to move the set.
This code used to consider it OK to move a set of a variable