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: [RFC] Do pointer comparison first in operand_equal_p


On Fri, 13 May 2005, Diego Novillo wrote:
> OK, though I'm not interested in guessing what it may break.

It just occurred to me that the reason why testing worked for you
was probably due to the large amount of unsharing performed by the
tree optimizers.  Rather than minimize memory footprint by allowing
structurally equivalent trees to be shared, provided all modifications
are copy-on-write and garbage collected (as is done in fold), the
tree-ssa passes now unshare tree nodes, except constants, between
statements and destructively modify them in place.

This means, if the tree unsharing is done correctly, that arg0 == arg1
should never apply to non-constant but identical expressions between
SSA statements.  This may allow your change to be safe, but would require
a bucket load more commentary above your new lines, to explain why it
is safe.  Failure to unshare trees in the tree-ssa optimizers may lead
to a silent miscompilation via the modified operand_equal_p.

It might also be necessary to double check that the front-ends don't
use operand_equal_p prior to gimplification.  I believe all the uses
in fold, which are within a single expression are safe, as embedded
MODIFY_EXPR and CALL_EXPR nodes will be marked with side-effects.

Roger
--


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