aboutsummaryrefslogtreecommitdiff
path: root/gcc/genmatch.c
diff options
context:
space:
mode:
authorRichard Biener <rguenther@suse.de>2016-10-05 11:38:59 +0000
committerRichard Biener <rguenth@gcc.gnu.org>2016-10-05 11:38:59 +0000
commit39bb7d015297586294c6416a4db78b50345d2a46 (patch)
tree3a7a8b7f9c7e9c3afc2ea544f0459e8e8419cdd9 /gcc/genmatch.c
parenteeb57981e2d639f144ee6264fdc2bf6f23f8508b (diff)
downloadgcc-39bb7d015297586294c6416a4db78b50345d2a46.zip
gcc-39bb7d015297586294c6416a4db78b50345d2a46.tar.gz
gcc-39bb7d015297586294c6416a4db78b50345d2a46.tar.bz2
re PR target/77826 (ICE in decompose, at wide-int.h:928 w/ -m64 -O2 and above)
2016-10-05 Richard Biener <rguenther@suse.de> PR middle-end/77826 * genmatch.c (dt_operand::gen_match_op): Amend operand_equal_p with types_match for GIMPLE code gen to handle type mismatched constants properly. (dt_operand::gen): Adjust. * match.pd ((X /[ex] A) * A -> X): Properly handle converted and constant A. * gcc.dg/torture/pr77826.c: New testcase. From-SVN: r240776
Diffstat (limited to 'gcc/genmatch.c')
-rw-r--r--gcc/genmatch.c16
1 files changed, 11 insertions, 5 deletions
diff --git a/gcc/genmatch.c b/gcc/genmatch.c
index c3f128c..5883ba3 100644
--- a/gcc/genmatch.c
+++ b/gcc/genmatch.c
@@ -1562,7 +1562,7 @@ struct dt_operand : public dt_node
void gen (FILE *, int, bool);
unsigned gen_predicate (FILE *, int, const char *, bool);
- unsigned gen_match_op (FILE *, int, const char *);
+ unsigned gen_match_op (FILE *, int, const char *, bool);
unsigned gen_gimple_expr (FILE *, int);
unsigned gen_generic_expr (FILE *, int, const char *);
@@ -2589,12 +2589,18 @@ dt_operand::gen_predicate (FILE *f, int indent, const char *opname, bool gimple)
a capture-match. */
unsigned
-dt_operand::gen_match_op (FILE *f, int indent, const char *opname)
+dt_operand::gen_match_op (FILE *f, int indent, const char *opname, bool gimple)
{
char match_opname[20];
match_dop->get_name (match_opname);
- fprintf_indent (f, indent, "if (%s == %s || operand_equal_p (%s, %s, 0))\n",
- opname, match_opname, opname, match_opname);
+ if (gimple)
+ fprintf_indent (f, indent, "if (%s == %s || (operand_equal_p (%s, %s, 0) "
+ "&& types_match (%s, %s)))\n",
+ opname, match_opname, opname, match_opname,
+ opname, match_opname);
+ else
+ fprintf_indent (f, indent, "if (%s == %s || operand_equal_p (%s, %s, 0))\n",
+ opname, match_opname, opname, match_opname);
fprintf_indent (f, indent + 2, "{\n");
return 1;
}
@@ -2991,7 +2997,7 @@ dt_operand::gen (FILE *f, int indent, bool gimple)
else if (type == DT_TRUE)
;
else if (type == DT_MATCH)
- n_braces = gen_match_op (f, indent, opname);
+ n_braces = gen_match_op (f, indent, opname, gimple);
else
gcc_unreachable ();