This is the mail archive of the
mailing list for the GCC project.
Re: [RFC] Do pointer comparison first in operand_equal_p
- From: Roger Sayle <roger at eyesopen dot com>
- To: Diego Novillo <dnovillo at redhat dot com>
- Cc: gcc-patches at gcc dot gnu dot org
- Date: Fri, 13 May 2005 10:02:43 -0600 (MDT)
- Subject: 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.