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]

Re: [PATCH] Split critical edges before late uninit warning pass


On Wed, 11 Sep 2013, Jakub Jelinek wrote:

> On Wed, Sep 11, 2013 at 12:00:04PM +0200, Richard Biener wrote:
> > 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?
> 
> Looks reasonable to me.

Bootstrapped and tested on x86_64-unknonw-linux-gnu and applied.

Richard.

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

	PR middle-end/58377
	* passes.def: Split critical edges before late uninit warning passes.
	* tree-cfg.c (pass_split_crit_edges): Implement clone method.

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

Index: gcc/passes.def
===================================================================
*** gcc/passes.def	(revision 202492)
--- gcc/passes.def	(working copy)
*************** along with GCC; see the file COPYING3.
*** 249,254 ****
--- 249,257 ----
  	 account for the predicates protecting the set and the use of each
  	 variable.  Using a representation like Gated Single Assignment
  	 may help.  */
+       /* 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_dse);
        NEXT_PASS (pass_forwprop);
*************** along with GCC; see the file COPYING3.
*** 282,287 ****
--- 285,293 ----
        /* ???  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/tree-cfg.c
===================================================================
*** gcc/tree-cfg.c	(revision 202492)
--- gcc/tree-cfg.c	(working copy)
*************** public:
*** 7929,7934 ****
--- 7949,7955 ----
    /* opt_pass methods: */
    unsigned int execute () { return split_critical_edges (); }
  
+   opt_pass * clone () { return new pass_split_crit_edges (ctxt_); }
  }; // class pass_split_crit_edges
  
  } // anon namespace
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]