This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] Split critical edges before late uninit warning pass


This patch adds critical edge splitting before the late uninit
warning pass in the -Og pipeline (the patch is for the 4.8 branch
where the testcase otherwise fails).  If I commit this then I'll
commit a corresponding change to trunk as well.

On trunk we can also split critical edges in the regular pipeline
to mitigate the issue the late uninit warning pass has with
critical edges, posssibly reducing the number of false positives.

Critical edges are unsplit by the next CFG cleanup which happens
at latest during pass_cleanup_cfg_post_optimizing.

Bootstrap / regtest running on the branch for x86_64-unknown-linux-gnu.

It should make -Og more usable on the branch and as it is quite
new I suppose the change qualifies for the branch (I lately
moved some passes there for other diagnostic issues).

Opinions on generally splitting critical edges before late
uninit warnings?

Thanks,
Richard.

2013-09-11  Richard Biener  <rguenther@suse.de>

	PR middle-end/58377
	* passes.c (init_optimization_passes): Split critical edges
	before late uninit warning pass.

	* g++.dg/uninit-pred-4.C: New testcase.

Index: gcc/passes.c
===================================================================
*** gcc/passes.c	(revision 202445)
--- gcc/passes.c	(working copy)
*************** init_optimization_passes (void)
*** 1543,1548 ****
--- 1543,1551 ----
        /* ???  We do want some kind of loop invariant motion, but we possibly
           need to adjust LIM to be more friendly towards preserving accurate
  	 debug information here.  */
+       /* Split critical edges before late uninit warning to reduce the
+          number of false positives from it.  */
+       NEXT_PASS (pass_split_crit_edges);
        NEXT_PASS (pass_late_warn_uninitialized);
        NEXT_PASS (pass_uncprop);
        NEXT_PASS (pass_local_pure_const);
Index: gcc/testsuite/g++.dg/uninit-pred-4.C
===================================================================
*** gcc/testsuite/g++.dg/uninit-pred-4.C	(revision 0)
--- gcc/testsuite/g++.dg/uninit-pred-4.C	(working copy)
***************
*** 0 ****
--- 1,16 ----
+ /* { dg-do compile } */
+ /* { dg-options "-Wuninitialized -Og" } */
+ 
+ int pop ();
+ int pop_first_bucket;
+ 
+ int my_pop ()
+ {
+   int out;  // { dg-bogus "uninitialized" "uninitialized variable warning" }
+ 
+   while (pop_first_bucket)
+     if (pop_first_bucket && (out = pop()))
+       return out;
+ 
+   return 0;
+ }


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]