On Wed, 2005-05-04 at 11:07, Jeffrey A Law wrote: > On Wed, 2005-05-04 at 10:28 -0400, Andrew MacLeod wrote: > > Why is it we try to swap operands in get_expr_operands, where we are > > otherwise simply parsing not modifying? > > > > /* If it would be profitable to swap the operands, then do so to > > canonicalize the statement, enabling better optimization. > > By placing canonicalization of such expressions here we > > transparently keep statements in canonical form, even > > when the statement is modified. */ > >
> An alternate approach would be to twiddle the hashing code -- that works > OK for commutative operands, but not necessarily for things like LT_EXPR > where putting things into canonical form involves changing the tree > code. I'll leave it as is for now. It seriously uglified the stmt verifier tho, as it has to look for swapped operands :-) Oh well. Andrew