Bug 18995 - delete_trivially_dead_insns fails to update the liveness information
Summary: delete_trivially_dead_insns fails to update the liveness information
Status: RESOLVED WONTFIX
Alias: None
Product: gcc
Classification: Unclassified
Component: rtl-optimization (show other bugs)
Version: 4.0.0
: P2 normal
Target Milestone: 4.3.0
Assignee: Not yet assigned to anyone
URL:
Keywords: ice-checking, ice-on-valid-code, patch
Depends on: 18992
Blocks: 29842 17652 23111 28177
  Show dependency treegraph
 
Reported: 2004-12-14 18:37 UTC by Jorn Wolfgang Rennecke
Modified: 2007-06-18 01:57 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed: 2006-01-15 21:17:24


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Jorn Wolfgang Rennecke 2004-12-14 18:37:51 UTC
When a register is set outside of a loop and referenced inside,
update_life_info can't figure out that the set is dead because
the loop appears to still use the register according to the
lifeness information which is propagated circularily around the
loop.
delete_trivially_dead_insns can detect that such sets are dead,
and thus remove them.  However, it does not update the liveness
information. This leads to a checking ICE when doing the next
global update.

The gcc 3.2 version of this patch (short version) for this problem
looks like this: 

2004-05-17  J"orn Rennecke <joern.rennecke@superh.com>

        * cse.c (basic-block.h): #include.
        (trivially_dead_nonlocal_regs): New variable.
        (note_dead_set): New function.
        (delete_trivially_dead_insns): If life info is available, update it.

The patch in its current form is conceptually dependent on the patch for
gcc/18992 being applied first and also has some bits to support highpart
liveness information optimizations.  It is about 100 lines of unidiff.
If someone is prepared to review the patch, I can extract an independent
patch against the then-current mainline.
Comment 1 Steven Bosscher 2005-01-15 12:29:20 UTC
Test case???

There are many other problems with delete_trivially_dead_insns, unsurprisingly,
so maybe the whole thing should be revisited and reconsidered :-/
Comment 2 joern.rennecke@st.com 2005-01-17 14:18:24 UTC
Subject: Re:  delete_trivially_dead_insns fails
 to update the liveness information

steven at gcc dot gnu dot org wrote:

>------- Additional Comments From steven at gcc dot gnu dot org  2005-01-15 12:29 -------
>Test case???
>

I had a test case for this, but this wouldn't reproduce the problem on 
mainline because most
of the functionality of delete_trivially_dead_insns has been disabled by 
a clumsy patch;
see PR 18992 .

>
>There are many other problems with delete_trivially_dead_insns, unsurprisingly,
>so maybe the whole thing should be revisited and reconsidered :-/
>

What other problems are there with delete_trivially_dead_insns?  As far 
as I am aware,
delete_trivially_dead_insns only needed maitenance when the semantics of 
the rtl
was changed (e.g. adding exceptions), it was called in new contexts 
(e.g. after flow),
or a previous modification wasn't (quite) right / sufficient.

In terms of time and code complexity versus optimization result, I think 
delete_trivially_dead_insns
compares quite favourably with running a full data flow and dead code 
elimination pass.

Comment 3 Jorn Wolfgang Rennecke 2005-03-02 17:54:55 UTC
A patch is here:
http://gcc.gnu.org/ml/gcc-patches/2004-06/msg00774.html

The size of this patch can also be reduced by setting update_live_p in
delete_trivially_dead_insns like this:

  bool update_life_p = EXIT_BLOCK_PTR->global_live_at_start != NULL;
Comment 4 Steven Bosscher 2006-12-17 14:48:15 UTC
There will be no more delete_trivially_dead_insns when the dataflow branch is merged.
Comment 5 Andrew Pinski 2007-06-18 01:57:59 UTC
delete_trivially_dead_insns is gone now that the dataflow branch has been merged in.  So closing as won't fix.