Commit fe477d8b by Jan Hubicka Committed by Jan Hubicka

cfgcleanup.c (mentions_nonequal_regs): New function.

	* cfgcleanup.c (mentions_nonequal_regs): New function.
	(thread_jump): Use it.
	* toplev.c (rest_of_compilation): Run jump threading after
	liveness.

From-SVN: r50361
parent 2041cde4
Wed Mar 6 18:14:43 CET 2002 Jan Hubicka <jh@suse.cz>
* cfgcleanup.c (mentions_nonequal_regs): New function.
(thread_jump): Use it.
* toplev.c (rest_of_compilation): Run jump threading after
liveness.
2002-03-06 Jakub Jelinek <jakub@redhat.com> 2002-03-06 Jakub Jelinek <jakub@redhat.com>
* ssa-ccp.c (ssa_ccp_substitute_constants): Backout 2002-03-05 * ssa-ccp.c (ssa_ccp_substitute_constants): Backout 2002-03-05
......
...@@ -89,6 +89,7 @@ static edge thread_jump PARAMS ((int, edge, basic_block)); ...@@ -89,6 +89,7 @@ static edge thread_jump PARAMS ((int, edge, basic_block));
static bool mark_effect PARAMS ((rtx, bitmap)); static bool mark_effect PARAMS ((rtx, bitmap));
static void notice_new_block PARAMS ((basic_block)); static void notice_new_block PARAMS ((basic_block));
static void update_forwarder_flag PARAMS ((basic_block)); static void update_forwarder_flag PARAMS ((basic_block));
static int mentions_nonequal_regs PARAMS ((rtx *, void *));
/* Set flags for newly created block. */ /* Set flags for newly created block. */
...@@ -235,6 +236,32 @@ mark_effect (exp, nonequal) ...@@ -235,6 +236,32 @@ mark_effect (exp, nonequal)
return false; return false;
} }
} }
/* Return nonzero if X is an register set in regset DATA.
Called via for_each_rtx. */
static int
mentions_nonequal_regs (x, data)
rtx *x;
void *data;
{
regset nonequal = (regset) data;
if (REG_P (*x))
{
int regno;
regno = REGNO (*x);
if (REGNO_REG_SET_P (nonequal, regno))
return 1;
if (regno < FIRST_PSEUDO_REGISTER)
{
int n = HARD_REGNO_NREGS (regno, GET_MODE (*x));
while (--n > 0)
if (REGNO_REG_SET_P (nonequal, regno + n))
return 1;
}
}
return 0;
}
/* Attempt to prove that the basic block B will have no side effects and /* Attempt to prove that the basic block B will have no side effects and
allways continues in the same edge if reached via E. Return the edge allways continues in the same edge if reached via E. Return the edge
if exist, NULL otherwise. */ if exist, NULL otherwise. */
...@@ -338,6 +365,11 @@ thread_jump (mode, e, b) ...@@ -338,6 +365,11 @@ thread_jump (mode, e, b)
if (failed) if (failed)
goto failed_exit; goto failed_exit;
/* cond2 must not mention any register that is not equal to the
former block. */
if (for_each_rtx (&cond2, mentions_nonequal_regs, nonequal))
goto failed_exit;
/* In case liveness information is available, we need to prove equivalence /* In case liveness information is available, we need to prove equivalence
only of the live values. */ only of the live values. */
if (mode & CLEANUP_UPDATE_LIFE) if (mode & CLEANUP_UPDATE_LIFE)
......
...@@ -3019,7 +3019,8 @@ rest_of_compilation (decl) ...@@ -3019,7 +3019,8 @@ rest_of_compilation (decl)
#endif #endif
life_analysis (insns, rtl_dump_file, PROP_FINAL); life_analysis (insns, rtl_dump_file, PROP_FINAL);
if (optimize) if (optimize)
cleanup_cfg (CLEANUP_EXPENSIVE | CLEANUP_UPDATE_LIFE); cleanup_cfg ((optimize ? CLEANUP_EXPENSIVE : 0)
| (flag_thread_jumps ? CLEANUP_THREADING : 0));
timevar_pop (TV_FLOW); timevar_pop (TV_FLOW);
no_new_pseudos = 1; no_new_pseudos = 1;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment