This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: PR tree-optimization/40676 (DCE VOPS messup)
- From: Richard Guenther <richard dot guenther at gmail dot com>
- To: Jan Hubicka <hubicka at ucw dot cz>
- Cc: gcc-patches at gcc dot gnu dot org, rguenther at suse dot de
- Date: Sat, 18 Jul 2009 22:44:12 +0200
- Subject: Re: PR tree-optimization/40676 (DCE VOPS messup)
- References: <20090718203841.GB15645@kam.mff.cuni.cz>
On Sat, Jul 18, 2009 at 10:38 PM, Jan Hubicka<hubicka@ucw.cz> wrote:
> Hi,
> the detailed description of patch is in the PR log. ?The problem here is
> that redirecting edges of CD-DCE messes up dominance information of dead
> virtual PHI nodes in case they appear in otherwise dead BB. ?This patch
> fixes it by sending all virtual PHIs in emty BBs for renaming. ?It would
> be possible to do more fine grained approach, but it would need one
> extra rebuilding of dominance info.
>
> Bootstrapped/regtested x86_64-linux, OK (testcase is for compile
> dirrectory)?
Ok.
Thanks,
Richard.
> extern int f1();
> extern int f2(void*);
> extern void* f3(int);
> int xmsih;
> typedef unsigned short XWCHAR;
>
> inline unsigned int xstrlenW( const XWCHAR *str )
> {
> ? ?const XWCHAR *s = str;
> ? ?while (*s) s++;
> ? ?return s - str;
> }
>
>
> static int msi_dialog_register_class( void )
> {
> ? ?int cls;
>
> ? ?if( !f2( &cls ) )
> ? ? ? ?return 0;
> ? ?if( !f2( &cls ) )
> ? ? ? ?return 0;
> ? ?xmsih = f1();
> ? ?if( !xmsih )
> ? ? ? ?return 0;
> ? ?return 1;
> }
>
> void *xmsi_dialog_create(const XWCHAR* szDialogName)
> {
> ? ?msi_dialog_register_class();
> ? ?return f3(xstrlenW(szDialogName));
> }
>
> ? ? ? ?PR tree-optimization/40676
> ? ? ? ?* tree-ssa-dce.c (eliminate_unnecessary_stmts): Do renaming on all
> ? ? ? ?virtual PHIs in empty BBs.
> Index: tree-ssa-dce.c
> ===================================================================
> *** tree-ssa-dce.c ? ? ?(revision 149706)
> --- tree-ssa-dce.c ? ? ?(working copy)
> *************** eliminate_unnecessary_stmts (void)
> *** 1137,1143 ****
> ? ? ? ?for (bb = ENTRY_BLOCK_PTR->next_bb; bb != EXIT_BLOCK_PTR; bb = next_bb)
> ? ? ? ?{
> ? ? ? ? ?next_bb = bb->next_bb;
> ! ? ? ? ? if (!(bb->flags & BB_REACHABLE))
> ? ? ? ? ? ?{
> ? ? ? ? ? ? ?for (gsi = gsi_start_phis (bb); !gsi_end_p (gsi); gsi_next (&gsi))
> ? ? ? ? ? ? ? ?if (!is_gimple_reg (gimple_phi_result (gsi_stmt (gsi))))
> --- 1136,1143 ----
> ? ? ? ?for (bb = ENTRY_BLOCK_PTR->next_bb; bb != EXIT_BLOCK_PTR; bb = next_bb)
> ? ? ? ?{
> ? ? ? ? ?next_bb = bb->next_bb;
> ! ? ? ? ? if (!TEST_BIT (bb_contains_live_stmts, bb->index)
> ! ? ? ? ? ? ? || !(bb->flags & BB_REACHABLE))
> ? ? ? ? ? ?{
> ? ? ? ? ? ? ?for (gsi = gsi_start_phis (bb); !gsi_end_p (gsi); gsi_next (&gsi))
> ? ? ? ? ? ? ? ?if (!is_gimple_reg (gimple_phi_result (gsi_stmt (gsi))))
> *************** eliminate_unnecessary_stmts (void)
> *** 1159,1165 ****
> ? ? ? ? ? ? ? ? ? ?if (found)
> ? ? ? ? ? ? ? ? ? ? ?mark_virtual_phi_result_for_renaming (gsi_stmt (gsi));
> ? ? ? ? ? ? ? ? ?}
> ! ? ? ? ? ? ? delete_basic_block (bb);
> ? ? ? ? ? ?}
> ? ? ? ?}
> ? ? ?}
> --- 1159,1166 ----
> ? ? ? ? ? ? ? ? ? ?if (found)
> ? ? ? ? ? ? ? ? ? ? ?mark_virtual_phi_result_for_renaming (gsi_stmt (gsi));
> ? ? ? ? ? ? ? ? ?}
> ! ? ? ? ? ? ? if (!(bb->flags & BB_REACHABLE))
> ! ? ? ? ? ? ? ? delete_basic_block (bb);
> ? ? ? ? ? ?}
> ? ? ? ?}
>
> ? ? ?}
>