This avoids matching loads in the signle-rhs matching logic. Bootstrapped and tested on x86_64-unknown-linux-gnu, applied.
Richard. 2014-08-21 Richard Biener <rguent...@suse.de> * genmatch.c (dt_operand::gen_gimple_expr): Only match non-reference-like GIMPLE single RHS. Index: gcc/genmatch.c =================================================================== --- gcc/genmatch.c (revision 214225) +++ gcc/genmatch.c (working copy) @@ -1297,8 +1297,19 @@ dt_operand::gen_gimple_expr (FILE *f) { if (*id == REALPART_EXPR || *id == IMAGPART_EXPR || *id == BIT_FIELD_REF || *id == VIEW_CONVERT_EXPR) - fprintf (f, "tree %s = TREE_OPERAND (gimple_assign_rhs1 (def_stmt), %i);\n", - child_opname, i); + { + /* ??? If this is a memory operation we can't (and should not) + match this. The only sensible operand types are + SSA names and invariants. */ + fprintf (f, "tree %s = TREE_OPERAND (gimple_assign_rhs1 (def_stmt), %i);\n", + child_opname, i); + fprintf (f, "if ((TREE_CODE (%s) == SSA_NAME\n" + "&& (%s = do_valueize (valueize, %s)))\n" + "|| is_gimple_min_invariant (%s))\n" + "{\n", child_opname, child_opname, child_opname, + child_opname); + continue; + } else fprintf (f, "tree %s = gimple_assign_rhs%u (def_stmt);\n", child_opname, i + 1);