summaryrefslogtreecommitdiff
path: root/gcc/cse.c
diff options
context:
space:
mode:
authorlaw <law@138bc75d-0d04-0410-961f-82ee72b054a4>1999-09-06 08:44:50 +0000
committerlaw <law@138bc75d-0d04-0410-961f-82ee72b054a4>1999-09-06 08:44:50 +0000
commit230d893b93ee905544aabaeee18e39a116e5b46a (patch)
treedfd9f56ed37e8448c9b5512002fa1ef6c3187c0f /gcc/cse.c
parentf004f6ed5469be970d8ae1d0e13ffc3ec8a78115 (diff)
downloadgcc-230d893b93ee905544aabaeee18e39a116e5b46a.tar.gz
* cse.c (delete_trivially_dead_insns): Do not skip the last
insn if it is a real insn. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@29138 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/cse.c')
-rw-r--r--gcc/cse.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/gcc/cse.c b/gcc/cse.c
index 68fe7b04a92..d1a2487cb41 100644
--- a/gcc/cse.c
+++ b/gcc/cse.c
@@ -9135,8 +9135,16 @@ delete_trivially_dead_insns (insns, nreg)
/* Go from the last insn to the first and delete insns that only set unused
registers or copy a register to itself. As we delete an insn, remove
- usage counts for registers it uses. */
- for (insn = prev_real_insn (get_last_insn ()); insn; insn = prev)
+ usage counts for registers it uses.
+
+ The first jump optimization pass may leave a real insn as the last
+ insn in the function. We must not skip that insn or we may end
+ up deleting code that is not really dead. */
+ insn = get_last_insn ();
+ if (GET_RTX_CLASS (GET_CODE (insn)) != 'i')
+ insn = prev_real_insn (insn);
+
+ for ( ; insn; insn = prev)
{
int live_insn = 0;
rtx note;