summaryrefslogtreecommitdiff
path: root/gcc/loop.c
diff options
context:
space:
mode:
authorwilson <wilson@138bc75d-0d04-0410-961f-82ee72b054a4>2000-09-01 22:01:43 +0000
committerwilson <wilson@138bc75d-0d04-0410-961f-82ee72b054a4>2000-09-01 22:01:43 +0000
commit8a37f84e7fc277b8402b3daecac775f772622e9f (patch)
tree6327ea45abb944fe5103ee36b69180bf23f8275a /gcc/loop.c
parent1a8328854be9122c6f8c0592dd360d3d045f4c6e (diff)
downloadgcc-8a37f84e7fc277b8402b3daecac775f772622e9f.tar.gz
Fix ia64-linux miscompilation or tcl/generic/tclCompExpr.c
* loop.c (check_final_value): Check for biv use before checking for giv use. Check for both biv and giv uses. Always set last_giv_use if there is a giv use. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@36104 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/loop.c')
-rw-r--r--gcc/loop.c18
1 files changed, 12 insertions, 6 deletions
diff --git a/gcc/loop.c b/gcc/loop.c
index 5c70055d265..c5e5c4c2ccb 100644
--- a/gcc/loop.c
+++ b/gcc/loop.c
@@ -5677,19 +5677,25 @@ check_final_value (loop, v)
if (GET_CODE (p) == INSN || GET_CODE (p) == JUMP_INSN
|| GET_CODE (p) == CALL_INSN)
{
- if (biv_increment_seen)
+ /* It is possible for the BIV increment to use the GIV if we
+ have a cycle. Thus we must be sure to check each insn for
+ both BIV and GIV uses, and we must check for BIV uses
+ first. */
+
+ if (! biv_increment_seen
+ && reg_set_p (v->src_reg, PATTERN (p)))
+ biv_increment_seen = 1;
+
+ if (reg_mentioned_p (v->dest_reg, PATTERN (p)))
{
- if (reg_mentioned_p (v->dest_reg, PATTERN (p)))
+ if (biv_increment_seen)
{
v->replaceable = 0;
v->not_replaceable = 1;
break;
}
+ last_giv_use = p;
}
- else if (reg_set_p (v->src_reg, PATTERN (p)))
- biv_increment_seen = 1;
- else if (reg_mentioned_p (v->dest_reg, PATTERN (p)))
- last_giv_use = p;
}
}