This patch avoids multiple definitions of def_stmt in different blocks, and moves it at the beginning of gimple_match_and_simplify.
* genmatch.c (decision_tree::gen_gimple): Call fprintf to generate definition of def_stmt. (dt_operand::gen_gimple_expr): Adjust call to fprintf to generate assignment of def_stmt. Thanks and Regards, Prathamesh
Index: gcc/genmatch.c =================================================================== --- gcc/genmatch.c (revision 211950) +++ gcc/genmatch.c (working copy) @@ -960,7 +960,7 @@ dt_operand::gen_gimple_expr (FILE *f, co fprintf (f, "if (TREE_CODE (%s) == SSA_NAME)\n", opname); fprintf (f, "{\n"); - fprintf (f, "gimple def_stmt = SSA_NAME_DEF_STMT (%s);\n", opname); + fprintf (f, "def_stmt = SSA_NAME_DEF_STMT (%s);\n", opname); (e->operation->op->kind == id_base::CODE) ? gen_gimple_expr_expr (f, e) : gen_gimple_expr_fn (f, e); return e->ops.length () + 2; @@ -1261,6 +1261,7 @@ decision_tree::gen_gimple (FILE *f) fprintf (f, ", tree op%d", i); fprintf (f, ")\n"); fprintf (f, "{\n"); + fprintf (f, "gimple def_stmt;\n"); for (unsigned i = 0; i < root->kids.length (); i++) {