aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard Biener <rguenther@suse.de>2015-08-25 10:29:09 +0000
committerRichard Biener <rguenth@gcc.gnu.org>2015-08-25 10:29:09 +0000
commite4cdf6a8c506f03903c614ec14cc8152d52d6a4e (patch)
tree2dd439cd002ec24938140110f94b6c6e54dcfec3
parente36dbdfe551a89808e0a3d4c5bd6df7e79401eb6 (diff)
downloadgcc-e4cdf6a8c506f03903c614ec14cc8152d52d6a4e.zip
gcc-e4cdf6a8c506f03903c614ec14cc8152d52d6a4e.tar.gz
gcc-e4cdf6a8c506f03903c614ec14cc8152d52d6a4e.tar.bz2
re PR tree-optimization/67306 (Patterns ICEs when moved using "simplify and match")
2015-08-25 Richard Biener <rguenther@suse.de> PR middle-end/67306 * genmatch.c (expr::gen_transform): Verify the result of builtin_decl_implicit. (dt_simplify::gen_1): Likewise. From-SVN: r227163
-rw-r--r--gcc/ChangeLog7
-rw-r--r--gcc/genmatch.c31
2 files changed, 32 insertions, 6 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 7022a87..517d1a4 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,10 @@
+2015-08-25 Richard Biener <rguenther@suse.de>
+
+ PR middle-end/67306
+ * genmatch.c (expr::gen_transform): Verify the result of
+ builtin_decl_implicit.
+ (dt_simplify::gen_1): Likewise.
+
2015-08-25 Thomas Preud'homme <thomas.preudhomme@arm.com>
* config/arm/constraints.md: Also list Cs and US ARM-specific
diff --git a/gcc/genmatch.c b/gcc/genmatch.c
index f48e79d..d92d808 100644
--- a/gcc/genmatch.c
+++ b/gcc/genmatch.c
@@ -2177,11 +2177,19 @@ expr::gen_transform (FILE *f, int indent, const char *dest, bool gimple,
fprintf_indent (f, indent, "res = fold_build%d_loc (loc, %s, %s",
ops.length(), opr_name, type);
else
- fprintf_indent (f, indent, "res = build_call_expr_loc (loc, "
- "builtin_decl_implicit (%s), %d", opr_name, ops.length());
+ {
+ fprintf_indent (f, indent, "{\n");
+ fprintf_indent (f, indent, " tree decl = builtin_decl_implicit (%s);\n",
+ opr_name);
+ fprintf_indent (f, indent, " if (!decl) return NULL_TREE;\n");
+ fprintf_indent (f, indent, " res = build_call_expr_loc (loc, "
+ "decl, %d", ops.length());
+ }
for (unsigned i = 0; i < ops.length (); ++i)
fprintf (f, ", ops%d[%u]", depth, i);
fprintf (f, ");\n");
+ if (opr->kind != id_base::CODE)
+ fprintf_indent (f, indent, "}\n");
if (*opr == CONVERT_EXPR)
{
indent -= 2;
@@ -3069,13 +3077,24 @@ dt_simplify::gen_1 (FILE *f, int indent, bool gimple, operand *result)
*e->operation == CONVERT_EXPR
? "NOP_EXPR" : e->operation->id);
else
- fprintf_indent (f, indent,
- "res = build_call_expr_loc "
- "(loc, builtin_decl_implicit (%s), %d",
- e->operation->id, e->ops.length());
+ {
+ fprintf_indent (f, indent,
+ "{\n");
+ fprintf_indent (f, indent,
+ " tree decl = builtin_decl_implicit (%s);\n",
+ e->operation->id);
+ fprintf_indent (f, indent,
+ " if (!decl) return NULL_TREE;\n");
+ fprintf_indent (f, indent,
+ " res = build_call_expr_loc "
+ "(loc, decl, %d",
+ e->ops.length());
+ }
for (unsigned j = 0; j < e->ops.length (); ++j)
fprintf (f, ", res_op%d", j);
fprintf (f, ");\n");
+ if (!is_a <operator_id *> (opr))
+ fprintf_indent (f, indent, "}\n");
}
}
}