aboutsummaryrefslogtreecommitdiff
path: root/gcc/fold-const.c
diff options
context:
space:
mode:
authorRichard Kenner <kenner@vlsi1.ultra.nyu.edu>1998-03-18 13:45:28 +0000
committerRichard Henderson <rth@gcc.gnu.org>1998-03-18 05:45:28 -0800
commit52de9b6cff32fb1da2a135b4ac03c63a3117f544 (patch)
tree2acd431d2d2a70b8845f47ad260fb682bdbb506d /gcc/fold-const.c
parent7c00d1fe83e896e59dd6f445f0da11232ba0803f (diff)
downloadgcc-52de9b6cff32fb1da2a135b4ac03c63a3117f544.zip
gcc-52de9b6cff32fb1da2a135b4ac03c63a3117f544.tar.gz
gcc-52de9b6cff32fb1da2a135b4ac03c63a3117f544.tar.bz2
fold-const.c (operand_equal_for_comparison_p): See if equal when nop conversions are removed.
Wed Mar 18 13:46:07 1998 Richard Kenner <kenner@vlsi1.ultra.nyu.edu> * fold-const.c (operand_equal_for_comparison_p): See if equal when nop conversions are removed. From-SVN: r18672
Diffstat (limited to 'gcc/fold-const.c')
-rw-r--r--gcc/fold-const.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/gcc/fold-const.c b/gcc/fold-const.c
index 32f3996..3a24e4c 100644
--- a/gcc/fold-const.c
+++ b/gcc/fold-const.c
@@ -1909,7 +1909,7 @@ operand_equal_for_comparison_p (arg0, arg1, other)
tree other;
{
int unsignedp1, unsignedpo;
- tree primarg1, primother;
+ tree primarg0, primarg1, primother;
unsigned correct_width;
if (operand_equal_p (arg0, arg1, 0))
@@ -1919,6 +1919,14 @@ operand_equal_for_comparison_p (arg0, arg1, other)
|| ! INTEGRAL_TYPE_P (TREE_TYPE (arg1)))
return 0;
+ /* Discard any conversions that don't change the modes of ARG0 and ARG1
+ and see if the inner values are the same. This removes any
+ signedness comparison, which doesn't matter here. */
+ primarg0 = arg0, primarg1 = arg1;
+ STRIP_NOPS (primarg0); STRIP_NOPS (primarg1);
+ if (operand_equal_p (primarg0, primarg1, 0))
+ return 1;
+
/* Duplicate what shorten_compare does to ARG1 and see if that gives the
actual comparison operand, ARG0.