aboutsummaryrefslogtreecommitdiff
path: root/gcc/gcse.c
diff options
context:
space:
mode:
authorJan Hubicka <jh@suse.cz>2002-07-18 09:40:16 +0200
committerJan Hubicka <hubicka@gcc.gnu.org>2002-07-18 07:40:16 +0000
commitf305679f4e9bc6f1fcf3b97dfaaf82de51be152c (patch)
tree74081aa4c85f7fcf193584fd986eba23692d1327 /gcc/gcse.c
parentcd095b7d1fa01a4ea08194149a128807fc46e0cb (diff)
downloadgcc-f305679f4e9bc6f1fcf3b97dfaaf82de51be152c.zip
gcc-f305679f4e9bc6f1fcf3b97dfaaf82de51be152c.tar.gz
gcc-f305679f4e9bc6f1fcf3b97dfaaf82de51be152c.tar.bz2
gcse.c (hoist_expr_reaches_here_p): Stop once expr_bb is reached.
* gcse.c (hoist_expr_reaches_here_p): Stop once expr_bb is reached. * gcse.c (try_replace_reg): Do not return false positives. From-SVN: r55553
Diffstat (limited to 'gcc/gcse.c')
-rw-r--r--gcc/gcse.c25
1 files changed, 15 insertions, 10 deletions
diff --git a/gcc/gcse.c b/gcc/gcse.c
index 665be1f..bb36211 100644
--- a/gcc/gcse.c
+++ b/gcc/gcse.c
@@ -3971,24 +3971,27 @@ try_replace_reg (from, to, insn)
int success = 0;
rtx set = single_set (insn);
- success = validate_replace_src (from, to, insn);
+ if (reg_mentioned_p (from, PATTERN (insn)))
+ {
+ success = validate_replace_src (from, to, insn);
+ }
- /* If above failed and this is a single set, try to simplify the source of
- the set given our substitution. We could perhaps try this for multiple
- SETs, but it probably won't buy us anything. */
- if (!success && set != 0)
+ if (!success && set && reg_mentioned_p (from, SET_SRC (set)))
{
+ /* If above failed and this is a single set, try to simplify the source of
+ the set given our substitution. We could perhaps try this for multiple
+ SETs, but it probably won't buy us anything. */
src = simplify_replace_rtx (SET_SRC (set), from, to);
if (!rtx_equal_p (src, SET_SRC (set))
&& validate_change (insn, &SET_SRC (set), src, 0))
success = 1;
- }
- /* If we've failed to do replacement, have a single SET, and don't already
- have a note, add a REG_EQUAL note to not lose information. */
- if (!success && note == 0 && set != 0)
- note = set_unique_reg_note (insn, REG_EQUAL, copy_rtx (src));
+ /* If we've failed to do replacement, have a single SET, and don't already
+ have a note, add a REG_EQUAL note to not lose information. */
+ if (!success && note == 0 && set != 0)
+ note = set_unique_reg_note (insn, REG_EQUAL, copy_rtx (src));
+ }
/* If there is already a NOTE, update the expression in it with our
replacement. */
@@ -5879,6 +5882,8 @@ hoist_expr_reaches_here_p (expr_bb, expr_index, bb, visited)
if (pred->src == ENTRY_BLOCK_PTR)
break;
+ else if (pred_bb == expr_bb)
+ continue;
else if (visited[pred_bb->index])
continue;