fold-const.c (operand_equal_p): Consider NOP_EXPR and CONVERT_EXPR as equal nodes.
authorBin Cheng <bin.cheng@arm.com>
Thu, 13 Jun 2013 08:44:38 +0000 (08:44 +0000)
committerBin Cheng <amker@gcc.gnu.org>
Thu, 13 Jun 2013 08:44:38 +0000 (08:44 +0000)
* fold-const.c (operand_equal_p): Consider NOP_EXPR and
CONVERT_EXPR as equal nodes.

From-SVN: r200062

gcc/ChangeLog
gcc/fold-const.c

index 1d498f8a7453dedd033991c6e7d66b5c696934df..587c9b1e479254fa2ec1759a462bd99cc75ea64e 100644 (file)
@@ -1,3 +1,8 @@
+2013-06-13  Bin Cheng  <bin.cheng@arm.com>
+
+       * fold-const.c (operand_equal_p): Consider NOP_EXPR and
+       CONVERT_EXPR as equal nodes.
+
 2013-06-13  Bin Cheng  <bin.cheng@arm.com>
 
        * rtlanal.c (noop_move_p): Check the code to be executed for
index 66e565ced9040803ffe0b575678a971c481fbc02..998948b0e6d3051566d901ee800ce3e6d12815c3 100644 (file)
@@ -2473,9 +2473,13 @@ operand_equal_p (const_tree arg0, const_tree arg1, unsigned int flags)
     }
 
   if (TREE_CODE (arg0) != TREE_CODE (arg1)
-      /* This is needed for conversions and for COMPONENT_REF.
-        Might as well play it safe and always test this.  */
-      || TREE_CODE (TREE_TYPE (arg0)) == ERROR_MARK
+      /* NOP_EXPR and CONVERT_EXPR are considered equal.  */
+      && !(CONVERT_EXPR_P (arg0) && CONVERT_EXPR_P (arg1)))
+    return 0;
+
+  /* This is needed for conversions and for COMPONENT_REF.
+     Might as well play it safe and always test this.  */
+  if (TREE_CODE (TREE_TYPE (arg0)) == ERROR_MARK
       || TREE_CODE (TREE_TYPE (arg1)) == ERROR_MARK
       || TYPE_MODE (TREE_TYPE (arg0)) != TYPE_MODE (TREE_TYPE (arg1)))
     return 0;