aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBin Cheng <bin.cheng@arm.com>2013-06-13 08:44:38 +0000
committerBin Cheng <amker@gcc.gnu.org>2013-06-13 08:44:38 +0000
commita8355e51785ca09eadc0e56afd0778c4ce076e2f (patch)
treee79eeaa5ba12fc1b03e3d4ac020f07f2d9953b20
parent8f7e6e330bbd903c6c104fc016589b6ab6d04027 (diff)
downloadgcc-a8355e51785ca09eadc0e56afd0778c4ce076e2f.zip
gcc-a8355e51785ca09eadc0e56afd0778c4ce076e2f.tar.gz
gcc-a8355e51785ca09eadc0e56afd0778c4ce076e2f.tar.bz2
fold-const.c (operand_equal_p): Consider NOP_EXPR and CONVERT_EXPR as equal nodes.
* fold-const.c (operand_equal_p): Consider NOP_EXPR and CONVERT_EXPR as equal nodes. From-SVN: r200062
-rw-r--r--gcc/ChangeLog5
-rw-r--r--gcc/fold-const.c10
2 files changed, 12 insertions, 3 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 1d498f8..587c9b1 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,5 +1,10 @@
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
COND_EXEC.
diff --git a/gcc/fold-const.c b/gcc/fold-const.c
index 66e565c..998948b 100644
--- a/gcc/fold-const.c
+++ b/gcc/fold-const.c
@@ -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;