for (unsigned i = 0; i < ops.length (); ++i)
fprintf (f, ", _o%d[%u]", depth, i);
fprintf (f, ");\n");
- fprintf_indent (f, indent, "tem_op.resimplify (lseq, valueize);\n");
+ fprintf_indent (f, indent, "tem_op.resimplify (%s, valueize);\n",
+ !force_leaf ? "lseq" : "NULL");
fprintf_indent (f, indent,
"_r%d = maybe_push_res_to_seq (&tem_op, %s);\n", depth,
!force_leaf ? "lseq" : "NULL");
if (!is_predicate)
{
fprintf_indent (f, indent,
- "res_op->resimplify (lseq, valueize);\n");
+ "res_op->resimplify (%s, valueize);\n",
+ !e->force_leaf ? "lseq" : "NULL");
if (e->force_leaf)
fprintf_indent (f, indent,
"if (!maybe_push_res_to_seq (res_op, NULL)) "
--- /dev/null
+/* { dg-do compile } */
+/* { dg-options "-O2 -fdump-tree-forwprop1 -fdump-tree-optimized" } */
+
+unsigned char foo(int x)
+{
+ int t = -x;
+ unsigned char t1 = t;
+ unsigned char t2 = t;
+ /* We may not rewrite this as (unsigned char)(t - x). */
+ return t1 + t2;
+}
+
+/* { dg-final { scan-tree-dump-times "x_" 1 "forwprop1" } } */
+/* { dg-final { scan-tree-dump-times "x_" 1 "optimized" } } */