Re: [PATCH] Ignore EDGE_PRESERVE in flow info verification (PR rtl-optimization/49912)

2011-11-26 Thread Richard Henderson
On 11/25/2011 10:34 AM, Jakub Jelinek wrote:
>   PR rtl-optimization/49912
>   * cfgrtl.c (rtl_verify_flow_info_1): Ignore also EDGE_PRESERVE bit
>   when counting n_branch.
> 
>   * g++.dg/other/pr49912.C: New test.

Ok.


r~


[PATCH] Ignore EDGE_PRESERVE in flow info verification (PR rtl-optimization/49912)

2011-11-25 Thread Jakub Jelinek
Hi!

The following testcase ICEs during flow verification, because there is
an unconditional branch with EDGE_PRESERVE set on the edge and because of
that bit rtl_verify_flow_info_1 wouldn't count it as n_branch.

Fixed thusly, bootstrapped/regtested on x86_64-linux and i686-linux, ok for
trunk?

2011-11-25  Jakub Jelinek  

PR rtl-optimization/49912
* cfgrtl.c (rtl_verify_flow_info_1): Ignore also EDGE_PRESERVE bit
when counting n_branch.

* g++.dg/other/pr49912.C: New test.

--- gcc/cfgrtl.c.jj 2011-11-21 16:22:02.0 +0100
+++ gcc/cfgrtl.c2011-11-25 10:29:54.272326735 +0100
@@ -1875,7 +1875,8 @@ rtl_verify_flow_info_1 (void)
| EDGE_CAN_FALLTHRU
| EDGE_IRREDUCIBLE_LOOP
| EDGE_LOOP_EXIT
-   | EDGE_CROSSING)) == 0)
+   | EDGE_CROSSING
+   | EDGE_PRESERVE)) == 0)
n_branch++;
 
  if (e->flags & EDGE_ABNORMAL_CALL)
--- gcc/testsuite/g++.dg/other/pr49912.C.jj 2011-11-25 10:40:27.180613829 
+0100
+++ gcc/testsuite/g++.dg/other/pr49912.C2011-11-25 10:40:15.0 
+0100
@@ -0,0 +1,38 @@
+// PR rtl-optimization/49912
+// { dg-do compile }
+// { dg-require-effective-target freorder }
+// { dg-options "-O -freorder-blocks-and-partition" }
+
+int foo (int *);
+
+struct S
+{
+  int *m1 ();
+  S (int);
+   ~S () { foo (m1 ()); }
+};
+
+template 
+struct V
+{
+  S *v1;
+  void m2 (const S &);
+  S *base ();
+};
+
+template 
+void V::m2 (const S &x)
+{
+  S a = x;
+  S *l = base ();
+  while (l)
+*v1 = *--l;
+}
+
+V<0> v;
+
+void
+foo ()
+{
+  v.m2 (0);
+}

Jakub