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] tree-phinode.c: Clean up remove_phi_node.


Hi Jeff,

> This is fine.

Thanks.

> I will note the behavior of the new code is not exactly the same as
> the old code.
> 
> Specifically if the old code would do nothing if the passed in PHI
> was not in the chain of PHI nodes attached to BB.  I'm pretty sure
> the new code will segfault.
> 
> You might consider a follow-up patch which gives a more graceful
> failure mode via gcc_assert rather than segfaulting :-)

Well, I was aware of this segfault, and I was thinking that maybe I
can live with a segfault. :-) I heasitate a little bit to change the
"for" loop to

      for (loc = &(bb_ann (bb)->phi_nodes);
	   *loc != NULL_TREE && *loc != phi;
	   loc = &PHI_CHAIN (*loc))
	;
      gcc_assert (*loc == NULL_TREE);

because we have two "if"s in the loop condition.  It's not that this
function is very performance critical, but....  I'll leave the
decision up to you.  Would you like the "for" loop above?

Kazu Hirata


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