diff mbox

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

Message ID 20111125183419.GP27242@tyan-ft48-01.lab.bos.redhat.com
State New
Headers show

Commit Message

Jakub Jelinek Nov. 25, 2011, 6:34 p.m. UTC
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  <jakub@redhat.com>

	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.


	Jakub

Comments

Richard Henderson Nov. 26, 2011, 4:28 p.m. UTC | #1
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~
diff mbox

Patch

--- gcc/cfgrtl.c.jj	2011-11-21 16:22:02.000000000 +0100
+++ gcc/cfgrtl.c	2011-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.C	2011-11-25 10:40:15.000000000 +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 <int>
+struct V
+{
+  S *v1;
+  void m2 (const S &);
+  S *base ();
+};
+
+template <int N>
+void V<N>::m2 (const S &x)
+{
+  S a = x;
+  S *l = base ();
+  while (l)
+    *v1 = *--l;
+}
+
+V<0> v;
+
+void
+foo ()
+{
+  v.m2 (0);
+}