summaryrefslogtreecommitdiff
path: root/gcc/loop.c
diff options
context:
space:
mode:
authormmitchel <mmitchel@138bc75d-0d04-0410-961f-82ee72b054a4>1998-09-30 10:10:02 +0000
committermmitchel <mmitchel@138bc75d-0d04-0410-961f-82ee72b054a4>1998-09-30 10:10:02 +0000
commite173ff3c65df83e9102dc6a975dfe5fbfbe0e308 (patch)
tree013f50ee70583c8416e79aa57fe911e240371d76 /gcc/loop.c
parentb0464da8357e6925a25a5a63864b1a2534d494a2 (diff)
downloadgcc-e173ff3c65df83e9102dc6a975dfe5fbfbe0e308.tar.gz
* function.c (gen_mem_addressof): If the address REG is
REG_USERVAR_P make the new REG be so also. * loop.c (scan_loop): Apply DeMorgan's laws and add documentation in an attempt to clarify slightly. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@22667 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/loop.c')
-rw-r--r--gcc/loop.c38
1 files changed, 25 insertions, 13 deletions
diff --git a/gcc/loop.c b/gcc/loop.c
index f1a59b35f8d..0a6cf059b44 100644
--- a/gcc/loop.c
+++ b/gcc/loop.c
@@ -871,19 +871,31 @@ scan_loop (loop_start, end, 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)
;
- /* In order to move a register, we need to have one of three cases:
- (1) it is used only in the same basic block as the set
- (2) it is not a user variable and it is not used in the
- exit test (this can cause the variable to be used
- before it is set just like a user-variable).
- (3) the set is guaranteed to be executed once the loop starts,
- and the reg is not used until after that. */
- else if (! ((! maybe_never
- && ! loop_reg_used_before_p (set, p, loop_start,
- scan_start, end))
- || (! REG_USERVAR_P (SET_DEST (set))
- && ! REG_LOOP_TEST_P (SET_DEST (set)))
- || reg_in_basic_block_p (p, SET_DEST (set))))
+ else if (/* The set is a user-variable or it is used in
+ the exit test (this can cause the variable to be
+ used before it is set just like a
+ user-variable)... */
+ (REG_USERVAR_P (SET_DEST (set))
+ || REG_LOOP_TEST_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... */
+ && (maybe_never
+ || loop_reg_used_before_p (set, p, loop_start,
+ scan_start, end))
+ /* And 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)))
+ /* It is unsafe to move the set. The fact that these
+ three conditions are considered in conjunction means
+ that we are assuming various conditions, such as:
+
+ o It's OK to move a set of a variable which was not
+ created by the user and is not used in an exit test
+ even if that point in the set would not be reached
+ during execution of the loop. */
;
else if ((tem = invariant_p (src))
&& (dependencies == 0