On Wed, Oct 14, 2015 at 6:29 PM, Jan Hubicka <hubi...@ucw.cz> wrote: > Hi, > this patch adds VIEW_CONVERT_EXPR which is another code omitted in > operand_equal_p. During bootstrap there are about 1000 matches. > > Bootstrapped/regtested x86_64-linux, OK?
Eric, does that look ok WRT TYPE_ALIGN_OK? (that is, did we decide TYPE_ALIGN_OK is no longer needed?) > Honza > > * fold-const.c (operand_equal_p): Handle VIEW_CONVERT_EXPR. > Index: fold-const.c > =================================================================== > --- fold-const.c (revision 228735) > +++ fold-const.c (working copy) > @@ -2962,6 +2968,12 @@ operand_equal_p (const_tree arg0, const_ > case IMAGPART_EXPR: > return OP_SAME (0); > > + case VIEW_CONVERT_EXPR: > + if (!(flags & (OEP_ADDRESS_OF | OEP_CONSTANT_ADDRESS_OF)) > + && !types_compatible_p (TREE_TYPE (arg0), TREE_TYPE (arg1))) Note that mixing the GIMPLE types_compatible_p into operand_equal_p which is supposed to handle GENERIC as well looks dangerous. You short-cutted the type checks for OEP_ADDRESS_OF earlier so why do you need to preserve them here? The test looks bogus anyway, but maybe it's just too early in the morning ;) Shouldn't it be && types_compatible_p (...) (instead of && !types_com...)? Otherwise it looks really weird. Richard. > + return false; > + return OP_SAME (0); > + > case TARGET_MEM_REF: > case MEM_REF: > if (!(flags & (OEP_ADDRESS_OF | OEP_CONSTANT_ADDRESS_OF)))