This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: DCE fix


On Thu, 23 Jul 2009, Jan Hubicka wrote:

> Hi,
> the problem exposed in testcase is caused by PHI in dead BB defining
> virtual operand used by dead stmt.  This dead stmt define vop used by
> live stmt.
> 
> We handle the first case by replacing uses by SSA_NAME's var and sending
> symbol for renaming, but we do that only for live statements, so we skip
> the dead stmt.  When removing the dead stmt we compensate by replacing
> operands of live stmt by vuse patching back the dead stmt.
> 
> THe patch simply sends for updaiting all uses, dead or alive.  It woudl
> be also possible to do more work and do updating only in scenario
> described above.
> 
> Bootstrapped/regtested x86_64-linux, OK?

Ok.

Thanks,
Richard.

> struct S0 {
>   signed char f0;
>   signed char f4;
> };
> 
> struct S0 g_19 = {
>   7L, 0L
> };
> 
> struct S0 g_39 = {
>   0L, 0x49L
> };
> 
> struct S0 g_90 = {
>   1L, 0
> };
> 
> signed char g_125;
> signed char g_198;
> signed char g_218;
> 
> signed char func_17 (int p_18, struct S0 p_20, signed char p_22, signed char
> p_24)
> {
>   return p_20.f0;
> }
> 
> signed char func_61 (int p_63, signed char p_64, signed char p_65)
> {
>   return 0;
> }
> 
> struct S0 func_176 (int p_178, int p_179)
> {
>   return g_90;
> }
> 
> struct S0 func_160 (int p_161, int p_163)
> {
>   struct S0 l_240 = {
>     9L, 0L
>   };
>   if (func_17 (1, func_176 (g_218, 1), 1, 1))
>     {
>       struct S0 l_253 = {
>         0xE0, 0xB4L
>       };
>       return l_253;
>     }
>   return l_240;
> }
> 
> struct S0 func_150 (int p_151, signed char p_153, signed char p_154, signed
> char p_155)
> {
>   signed char l_156 = 0;
>   signed char l_266 = 0;
>   if (func_17
>       (func_61
>        (g_125, l_156,
>         func_61 (1, func_17 (1, func_160 (l_266, g_90.f4), p_153, 1), 1)),
>        func_176 (g_39.f0, 1), 1, 1))
>     {
>       g_198 = 1;
>     }
>   return g_19;
> }
> 	PR tree-optimization/40759
> 	* tree-ssa-dce.c (mark_virtual_phi_result_for_renaming): Mark all uses
> 	for renaming.
> Index: tree-ssa-dce.c
> ===================================================================
> *** tree-ssa-dce.c	(revision 150009)
> --- tree-ssa-dce.c	(working copy)
> *************** mark_virtual_phi_result_for_renaming (gi
> *** 828,836 ****
>       }
>     FOR_EACH_IMM_USE_STMT (stmt, iter, gimple_phi_result (phi))
>       {
> -       if (gimple_code (stmt) != GIMPLE_PHI
> - 	  && !gimple_plf (stmt, STMT_NECESSARY))
> -         continue;
>         FOR_EACH_IMM_USE_ON_STMT (use_p, iter)
>           SET_USE (use_p, SSA_NAME_VAR (gimple_phi_result (phi)));
>         update_stmt (stmt);
> --- 828,833 ----
> 
> 

-- 
Richard Guenther <rguenther@suse.de>
Novell / SUSE Labs
SUSE LINUX Products GmbH - Nuernberg - AG Nuernberg - HRB 16746 - GF: Markus Rex


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]