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: [PATCH][RFC] Get back what DCE was able to do in 4.2 with V_MUST_DEFs


Hello,

> *************** remove_dead_stmt (block_stmt_iterator *i
> *** 648,654 ****
>             remove_edge (EDGE_SUCC (bb, 1));
>   	}
>       }
> !   
>     bsi_remove (i, true);  
>     release_defs (t); 
>   }
> --- 698,735 ----
>             remove_edge (EDGE_SUCC (bb, 1));
>   	}
>       }
> ! 
> !   /* Update uses of VDEFs in t.  */
> !   FOR_EACH_SSA_VDEF_OPERAND (def_p, usevect, t, iter)
> !     {
> !       imm_use_iterator iter2;
> !       use_operand_p use_p;
> !       tree stmt, use;
> ! 
> !       gcc_assert (VUSE_VECT_NUM_ELEM (*usevect) == 1);
> ! 
> !       use = VUSE_ELEMENT_VAR (*usevect, 0);
> ! 
> !       /* If we are messing with a use defined in a loop PHI, make us
> ! 	 propagate the default def instead.  */
> !       FOR_EACH_IMM_USE_FAST (use_p, iter2, DEF_FROM_PTR (def_p))
> ! 	if (TREE_CODE (USE_STMT (use_p)) == PHI_NODE
> ! 	    && PHI_RESULT_TREE (USE_STMT (use_p)) == use)
> ! 	  {
> ! 	    use = gimple_default_def (cfun, SSA_NAME_VAR (use));
> ! 	    break;
> ! 	  }

what is the purpose of this hack (why do you need to use the default
def)?  And why is it even correct (it seems that this should create
overlaping life ranges for virtual operand SSA names)?  I think it
needs to be also explained in the comment.

> !       FOR_EACH_IMM_USE_STMT (stmt, iter2, DEF_FROM_PTR (def_p))
> ! 	FOR_EACH_IMM_USE_ON_STMT (use_p, iter2)
> ! 	  SET_USE (use_p, use);

This should use replace_uses_by (otherwise you are missing at least
updating SSA_NAME_OCCURS_IN_ABNORMAL_PHI).

Zdenek


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