public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH] Fix memory leaks and use a pool_allocator
@ 2015-11-09 11:22 Martin Liška
  2015-11-09 12:11 ` Richard Biener
                   ` (6 more replies)
  0 siblings, 7 replies; 42+ messages in thread
From: Martin Liška @ 2015-11-09 11:22 UTC (permalink / raw)
  To: GCC Patches; +Cc: Richard Biener

[-- Attachment #1: Type: text/plain, Size: 171 bytes --]

Hi.

This is follow-up of changes that Richi started on Friday.

Patch can bootstrap on x86_64-linux-pc and regression tests are running.

Ready for trunk?
Thanks,
Martin

[-- Attachment #2: 0001-Fix-memory-leaks-and-use-a-pool_allocator.patch --]
[-- Type: text/x-patch, Size: 6862 bytes --]

From ece1ad32be127c1e00dd18c8d0358bf842fad2bd Mon Sep 17 00:00:00 2001
From: marxin <mliska@suse.cz>
Date: Mon, 9 Nov 2015 10:49:14 +0100
Subject: [PATCH] Fix memory leaks and use a pool_allocator

gcc/ChangeLog:

2015-11-09  Martin Liska  <mliska@suse.cz>

	* gcc.c (record_temp_file): Release name string.
	* ifcvt.c (noce_convert_multiple_sets): Release temporaries
	vector.
	* lra-lives.c (free_live_range_list): Utilize
	lra_live_range_pool for allocation and deallocation.
	(create_live_range): Likewise.
	(copy_live_range): Likewise.
	(lra_merge_live_ranges): Likewise.
	(remove_some_program_points_and_update_live_ranges): Likewise.
	(lra_create_live_ranges_1): Release point_freq_vec that can
	be not freed from previous iteration of the function.
	* tree-eh.c (lower_try_finally_switch): Release a vector.
	* tree-sra.c (sra_deinitialize): Release all vectors in
	base_access_vec.
	* tree-ssa-dom.c (free_edge_info): Make the function extern.
	* tree-ssa-threadupdate.c (remove_ctrl_stmt_and_useless_edges):
	Release edge_info for a removed edge.
	(thread_through_all_blocks): Free region vector.
	* tree-ssa.h (free_edge_info): Declare function extern.
---
 gcc/gcc.c                   |  5 ++++-
 gcc/ifcvt.c                 |  3 +++
 gcc/lra-lives.c             | 11 ++++++-----
 gcc/tree-eh.c               |  2 ++
 gcc/tree-sra.c              |  4 ++++
 gcc/tree-ssa-dom.c          |  2 +-
 gcc/tree-ssa-threadupdate.c |  6 +++++-
 gcc/tree-ssa.h              |  1 +
 8 files changed, 26 insertions(+), 8 deletions(-)

diff --git a/gcc/gcc.c b/gcc/gcc.c
index bbc9b23..8bbf5be 100644
--- a/gcc/gcc.c
+++ b/gcc/gcc.c
@@ -2345,7 +2345,10 @@ record_temp_file (const char *filename, int always_delete, int fail_delete)
       struct temp_file *temp;
       for (temp = always_delete_queue; temp; temp = temp->next)
 	if (! filename_cmp (name, temp->name))
-	  goto already1;
+	  {
+	    free (name);
+	    goto already1;
+	  }
 
       temp = XNEW (struct temp_file);
       temp->next = always_delete_queue;
diff --git a/gcc/ifcvt.c b/gcc/ifcvt.c
index fff62de..eb6b7df 100644
--- a/gcc/ifcvt.c
+++ b/gcc/ifcvt.c
@@ -3161,6 +3161,8 @@ noce_convert_multiple_sets (struct noce_if_info *if_info)
       set_used_flags (targets[i]);
     }
 
+  temporaries.release ();
+
   set_used_flags (cond);
   set_used_flags (x);
   set_used_flags (y);
@@ -3194,6 +3196,7 @@ noce_convert_multiple_sets (struct noce_if_info *if_info)
     }
 
   num_updated_if_blocks++;
+  targets.release ();
   return TRUE;
 }
 
diff --git a/gcc/lra-lives.c b/gcc/lra-lives.c
index 1655c47..87003be 100644
--- a/gcc/lra-lives.c
+++ b/gcc/lra-lives.c
@@ -103,7 +103,7 @@ free_live_range_list (lra_live_range_t lr)
   while (lr != NULL)
     {
       next = lr->next;
-      delete lr;
+      lra_live_range_pool.remove (lr);
       lr = next;
     }
 }
@@ -112,7 +112,7 @@ free_live_range_list (lra_live_range_t lr)
 static lra_live_range_t
 create_live_range (int regno, int start, int finish, lra_live_range_t next)
 {
-  lra_live_range_t p = new lra_live_range;
+  lra_live_range_t p = lra_live_range_pool.allocate ();
   p->regno = regno;
   p->start = start;
   p->finish = finish;
@@ -124,7 +124,7 @@ create_live_range (int regno, int start, int finish, lra_live_range_t next)
 static lra_live_range_t
 copy_live_range (lra_live_range_t r)
 {
-  return new lra_live_range (*r);
+  return new (lra_live_range_pool) lra_live_range (*r);
 }
 
 /* Copy live range list given by its head R and return the result.  */
@@ -167,7 +167,7 @@ lra_merge_live_ranges (lra_live_range_t r1, lra_live_range_t r2)
 	  r1->start = r2->start;
 	  lra_live_range_t temp = r2;
 	  r2 = r2->next;
-	  delete temp;
+	  lra_live_range_pool.remove (temp);
 	}
       else
 	{
@@ -1081,7 +1081,7 @@ remove_some_program_points_and_update_live_ranges (void)
 		}
 	      prev_r->start = r->start;
 	      prev_r->next = next_r;
-	      delete r;
+	      lra_live_range_pool.remove (r);
 	    }
 	}
     }
@@ -1240,6 +1240,7 @@ lra_create_live_ranges_1 (bool all_p, bool dead_insn_p)
   dead_set = sparseset_alloc (max_regno);
   unused_set = sparseset_alloc (max_regno);
   curr_point = 0;
+  point_freq_vec.release ();
   point_freq_vec.create (get_max_uid () * 2);
   lra_point_freq = point_freq_vec.address ();
   int *post_order_rev_cfg = XNEWVEC (int, last_basic_block_for_fn (cfun));
diff --git a/gcc/tree-eh.c b/gcc/tree-eh.c
index 617d657..be140ee 100644
--- a/gcc/tree-eh.c
+++ b/gcc/tree-eh.c
@@ -1557,6 +1557,8 @@ lower_try_finally_switch (struct leh_state *state, struct leh_tf_state *tf)
      due to not wanting to process the same goto stmts twice.  */
   gimple_seq_add_stmt (&tf->top_p_seq, switch_stmt);
   gimple_seq_add_seq (&tf->top_p_seq, switch_body);
+
+  case_label_vec.release ();
 }
 
 /* Decide whether or not we are going to duplicate the finally block.
diff --git a/gcc/tree-sra.c b/gcc/tree-sra.c
index a896308..85cc02b 100644
--- a/gcc/tree-sra.c
+++ b/gcc/tree-sra.c
@@ -674,6 +674,10 @@ sra_deinitialize (void)
   assign_link_pool.release ();
   obstack_free (&name_obstack, NULL);
 
+  for (hash_map<tree, auto_vec<access_p> >::iterator it =
+       base_access_vec->begin (); it != base_access_vec->end (); ++it)
+    (*it).second.release ();
+
   delete base_access_vec;
 }
 
diff --git a/gcc/tree-ssa-dom.c b/gcc/tree-ssa-dom.c
index 3887bbe1..15821fa 100644
--- a/gcc/tree-ssa-dom.c
+++ b/gcc/tree-ssa-dom.c
@@ -121,7 +121,7 @@ static void dump_dominator_optimization_stats (FILE *file,
 
 /* Free the edge_info data attached to E, if it exists.  */
 
-static void
+void
 free_edge_info (edge e)
 {
   struct edge_info *edge_info = (struct edge_info *)e->aux;
diff --git a/gcc/tree-ssa-threadupdate.c b/gcc/tree-ssa-threadupdate.c
index 184cf34..5f2587f 100644
--- a/gcc/tree-ssa-threadupdate.c
+++ b/gcc/tree-ssa-threadupdate.c
@@ -290,7 +290,10 @@ remove_ctrl_stmt_and_useless_edges (basic_block bb, basic_block dest_bb)
   for (ei = ei_start (bb->succs); (e = ei_safe_edge (ei)); )
     {
       if (e->dest != dest_bb)
-	remove_edge (e);
+	{
+	  free_edge_info (e);
+	  remove_edge (e);
+	}
       else
 	ei_next (&ei);
     }
@@ -2522,6 +2525,7 @@ thread_through_all_blocks (bool may_peel_loop_headers)
 
       delete_jump_thread_path (path);
       paths.unordered_remove (i);
+      free (region);
     }
 
   /* Remove from PATHS all the jump-threads starting with an edge already
diff --git a/gcc/tree-ssa.h b/gcc/tree-ssa.h
index 3b5bd70..47cb1e7 100644
--- a/gcc/tree-ssa.h
+++ b/gcc/tree-ssa.h
@@ -53,6 +53,7 @@ extern tree tree_ssa_strip_useless_type_conversions (tree);
 extern bool ssa_undefined_value_p (tree, bool = true);
 extern bool gimple_uses_undefined_value_p (gimple *);
 extern void execute_update_addresses_taken (void);
+extern void free_edge_info (edge);
 
 /* Given an edge_var_map V, return the PHI arg definition.  */
 
-- 
2.6.2


^ permalink raw reply	[flat|nested] 42+ messages in thread

* Re: [PATCH] Fix memory leaks and use a pool_allocator
  2015-11-09 11:22 [PATCH] Fix memory leaks and use a pool_allocator Martin Liška
@ 2015-11-09 12:11 ` Richard Biener
  2015-11-09 12:24   ` Trevor Saunders
  2015-11-09 13:26   ` Martin Liška
  2015-11-09 13:29 ` [PATCH] 02/N Fix memory leaks in IPA Martin Liška
                   ` (5 subsequent siblings)
  6 siblings, 2 replies; 42+ messages in thread
From: Richard Biener @ 2015-11-09 12:11 UTC (permalink / raw)
  To: Martin Liška; +Cc: GCC Patches

On Mon, Nov 9, 2015 at 12:22 PM, Martin Liška <mliska@suse.cz> wrote:
> Hi.
>
> This is follow-up of changes that Richi started on Friday.
>
> Patch can bootstrap on x86_64-linux-pc and regression tests are running.
>
> Ready for trunk?

        * tree-ssa-dom.c (free_edge_info): Make the function extern.
...
        * tree-ssa.h (free_edge_info): Declare function extern.

declare this in tree-ssa-threadupdate.h instead and renaming it to
sth less "public", like free_dom_edge_info.

diff --git a/gcc/ifcvt.c b/gcc/ifcvt.c
index fff62de..eb6b7df 100644
--- a/gcc/ifcvt.c
+++ b/gcc/ifcvt.c
@@ -3161,6 +3161,8 @@ noce_convert_multiple_sets (struct noce_if_info *if_info)
       set_used_flags (targets[i]);
     }

+  temporaries.release ();
+
   set_used_flags (cond);
   set_used_flags (x);
   set_used_flags (y);
@@ -3194,6 +3196,7 @@ noce_convert_multiple_sets (struct noce_if_info *if_info)
     }

   num_updated_if_blocks++;
+  targets.release ();
   return TRUE;

suspiciously look like candidates for an auto_vec<> (didn't check).

@@ -1240,6 +1240,7 @@ lra_create_live_ranges_1 (bool all_p, bool dead_insn_p)
   dead_set = sparseset_alloc (max_regno);
   unused_set = sparseset_alloc (max_regno);
   curr_point = 0;
+  point_freq_vec.release ();
   point_freq_vec.create (get_max_uid () * 2);

a truncate (0) instead of a release () should be cheaper, avoiding the
re-allocation.

@@ -674,6 +674,10 @@ sra_deinitialize (void)
   assign_link_pool.release ();
   obstack_free (&name_obstack, NULL);

+  for (hash_map<tree, auto_vec<access_p> >::iterator it =
+       base_access_vec->begin (); it != base_access_vec->end (); ++it)
+    (*it).second.release ();
+
   delete base_access_vec;

I wonder if the better fix is to provide a proper free method for the hash_map?
A hash_map with 'auto_vec' looks suspicous - eventually a proper release
was intented here via default_hash_map_traits <>?

Anyway, most of the things above can be improved as followup of course.

Thanks,
Richard.

> Thanks,
> Martin

^ permalink raw reply	[flat|nested] 42+ messages in thread

* Re: [PATCH] Fix memory leaks and use a pool_allocator
  2015-11-09 12:11 ` Richard Biener
@ 2015-11-09 12:24   ` Trevor Saunders
  2015-11-09 13:26   ` Martin Liška
  1 sibling, 0 replies; 42+ messages in thread
From: Trevor Saunders @ 2015-11-09 12:24 UTC (permalink / raw)
  To: Richard Biener; +Cc: Martin Liška, GCC Patches

On Mon, Nov 09, 2015 at 01:11:48PM +0100, Richard Biener wrote:
> On Mon, Nov 9, 2015 at 12:22 PM, Martin Liška <mliska@suse.cz> wrote:
> > Hi.
> >
> > This is follow-up of changes that Richi started on Friday.
> >
> > Patch can bootstrap on x86_64-linux-pc and regression tests are running.
> >
> > Ready for trunk?
> 
>         * tree-ssa-dom.c (free_edge_info): Make the function extern.
> ...
>         * tree-ssa.h (free_edge_info): Declare function extern.
> 
> declare this in tree-ssa-threadupdate.h instead and renaming it to
> sth less "public", like free_dom_edge_info.
> 
> diff --git a/gcc/ifcvt.c b/gcc/ifcvt.c
> index fff62de..eb6b7df 100644
> --- a/gcc/ifcvt.c
> +++ b/gcc/ifcvt.c
> @@ -3161,6 +3161,8 @@ noce_convert_multiple_sets (struct noce_if_info *if_info)
>        set_used_flags (targets[i]);
>      }
> 
> +  temporaries.release ();
> +
>    set_used_flags (cond);
>    set_used_flags (x);
>    set_used_flags (y);
> @@ -3194,6 +3196,7 @@ noce_convert_multiple_sets (struct noce_if_info *if_info)
>      }
> 
>    num_updated_if_blocks++;
> +  targets.release ();
>    return TRUE;
> 
> suspiciously look like candidates for an auto_vec<> (didn't check).

I was about to say the same thing after a little checking (maybe the
region one in tree-ssa-threadupdate.c to, but didn't check that)

> 
> @@ -1240,6 +1240,7 @@ lra_create_live_ranges_1 (bool all_p, bool dead_insn_p)
>    dead_set = sparseset_alloc (max_regno);
>    unused_set = sparseset_alloc (max_regno);
>    curr_point = 0;
> +  point_freq_vec.release ();
>    point_freq_vec.create (get_max_uid () * 2);
> 
> a truncate (0) instead of a release () should be cheaper, avoiding the
> re-allocation.

yeah, or even change it to just grow the array, afaict it doesn't expect
the array to be cleared?

> @@ -674,6 +674,10 @@ sra_deinitialize (void)
>    assign_link_pool.release ();
>    obstack_free (&name_obstack, NULL);
> 
> +  for (hash_map<tree, auto_vec<access_p> >::iterator it =
> +       base_access_vec->begin (); it != base_access_vec->end (); ++it)
> +    (*it).second.release ();
> +
>    delete base_access_vec;
> 
> I wonder if the better fix is to provide a proper free method for the hash_map?
> A hash_map with 'auto_vec' looks suspicous - eventually a proper release
> was intented here via default_hash_map_traits <>?

in fact I would expect that already works, but apparently not, so I'd
say that's the bug.

Trev

> 
> Anyway, most of the things above can be improved as followup of course.
> 
> Thanks,
> Richard.
> 
> > Thanks,
> > Martin

^ permalink raw reply	[flat|nested] 42+ messages in thread

* Re: [PATCH] Fix memory leaks and use a pool_allocator
  2015-11-09 12:11 ` Richard Biener
  2015-11-09 12:24   ` Trevor Saunders
@ 2015-11-09 13:26   ` Martin Liška
  2015-11-09 14:24     ` Richard Biener
  1 sibling, 1 reply; 42+ messages in thread
From: Martin Liška @ 2015-11-09 13:26 UTC (permalink / raw)
  To: Richard Biener; +Cc: GCC Patches

[-- Attachment #1: Type: text/plain, Size: 2310 bytes --]

On 11/09/2015 01:11 PM, Richard Biener wrote:
> On Mon, Nov 9, 2015 at 12:22 PM, Martin Liška <mliska@suse.cz> wrote:
>> Hi.
>>
>> This is follow-up of changes that Richi started on Friday.
>>
>> Patch can bootstrap on x86_64-linux-pc and regression tests are running.
>>
>> Ready for trunk?
> 
>         * tree-ssa-dom.c (free_edge_info): Make the function extern.
> ...
>         * tree-ssa.h (free_edge_info): Declare function extern.
> 
> declare this in tree-ssa-threadupdate.h instead and renaming it to
> sth less "public", like free_dom_edge_info.
> 
> diff --git a/gcc/ifcvt.c b/gcc/ifcvt.c
> index fff62de..eb6b7df 100644
> --- a/gcc/ifcvt.c
> +++ b/gcc/ifcvt.c
> @@ -3161,6 +3161,8 @@ noce_convert_multiple_sets (struct noce_if_info *if_info)
>        set_used_flags (targets[i]);
>      }
> 
> +  temporaries.release ();
> +
>    set_used_flags (cond);
>    set_used_flags (x);
>    set_used_flags (y);
> @@ -3194,6 +3196,7 @@ noce_convert_multiple_sets (struct noce_if_info *if_info)
>      }
> 
>    num_updated_if_blocks++;
> +  targets.release ();
>    return TRUE;
> 
> suspiciously look like candidates for an auto_vec<> (didn't check).
> 
> @@ -1240,6 +1240,7 @@ lra_create_live_ranges_1 (bool all_p, bool dead_insn_p)
>    dead_set = sparseset_alloc (max_regno);
>    unused_set = sparseset_alloc (max_regno);
>    curr_point = 0;
> +  point_freq_vec.release ();
>    point_freq_vec.create (get_max_uid () * 2);
> 
> a truncate (0) instead of a release () should be cheaper, avoiding the
> re-allocation.
> 
> @@ -674,6 +674,10 @@ sra_deinitialize (void)
>    assign_link_pool.release ();
>    obstack_free (&name_obstack, NULL);
> 
> +  for (hash_map<tree, auto_vec<access_p> >::iterator it =
> +       base_access_vec->begin (); it != base_access_vec->end (); ++it)
> +    (*it).second.release ();
> +
>    delete base_access_vec;
> 
> I wonder if the better fix is to provide a proper free method for the hash_map?
> A hash_map with 'auto_vec' looks suspicous - eventually a proper release
> was intented here via default_hash_map_traits <>?
> 
> Anyway, most of the things above can be improved as followup of course.
> 
> Thanks,
> Richard.
> 
>> Thanks,
>> Martin

Hi.

All suggested changes were applied, sending v2 and waiting for bootstrap and
regression tests.

Thanks,
Martin

[-- Attachment #2: 0001-Fix-memory-leaks-and-use-a-pool_allocator.patch --]
[-- Type: text/x-patch, Size: 8026 bytes --]

From c97270f2daadcca1efe6201adf1eb0df469ca91e Mon Sep 17 00:00:00 2001
From: marxin <mliska@suse.cz>
Date: Mon, 9 Nov 2015 10:49:14 +0100
Subject: [PATCH 1/2] Fix memory leaks and use a pool_allocator

gcc/ChangeLog:

2015-11-09  Martin Liska  <mliska@suse.cz>

	* gcc.c (record_temp_file): Release name string.
	* ifcvt.c (noce_convert_multiple_sets): Use auto_vec instead
	of vec.
	* lra-lives.c (free_live_range_list): Utilize
	lra_live_range_pool for allocation and deallocation.
	(create_live_range): Likewise.
	(copy_live_range): Likewise.
	(lra_merge_live_ranges): Likewise.
	(remove_some_program_points_and_update_live_ranges): Likewise.
	(lra_create_live_ranges_1): Release point_freq_vec that can
	be not freed from previous iteration of the function.
	* tree-eh.c (lower_try_finally_switch): Use auto_vec instead of
	vec.
	* tree-sra.c (sra_deinitialize): Release all vectors in
	base_access_vec.
	* tree-ssa-dom.c (free_dom_edge_info): Make the function extern.
	* tree-ssa-threadupdate.c (remove_ctrl_stmt_and_useless_edges):
	Release edge_info for a removed edge.
	(thread_through_all_blocks): Free region vector.
	* tree-ssa.h (free_dom_edge_info): Declare function extern.
---
 gcc/gcc.c                   |  5 ++++-
 gcc/ifcvt.c                 |  8 +++++---
 gcc/lra-lives.c             | 14 ++++++++------
 gcc/tree-eh.c               |  2 +-
 gcc/tree-sra.c              |  6 ++++++
 gcc/tree-ssa-dom.c          |  8 ++++----
 gcc/tree-ssa-threadupdate.c |  6 +++++-
 gcc/tree-ssa-threadupdate.h |  1 +
 8 files changed, 34 insertions(+), 16 deletions(-)

diff --git a/gcc/gcc.c b/gcc/gcc.c
index bbc9b23..8bbf5be 100644
--- a/gcc/gcc.c
+++ b/gcc/gcc.c
@@ -2345,7 +2345,10 @@ record_temp_file (const char *filename, int always_delete, int fail_delete)
       struct temp_file *temp;
       for (temp = always_delete_queue; temp; temp = temp->next)
 	if (! filename_cmp (name, temp->name))
-	  goto already1;
+	  {
+	    free (name);
+	    goto already1;
+	  }
 
       temp = XNEW (struct temp_file);
       temp->next = always_delete_queue;
diff --git a/gcc/ifcvt.c b/gcc/ifcvt.c
index fff62de..3401faa 100644
--- a/gcc/ifcvt.c
+++ b/gcc/ifcvt.c
@@ -3076,12 +3076,12 @@ noce_convert_multiple_sets (struct noce_if_info *if_info)
   rtx_code cond_code = GET_CODE (cond);
 
   /* The true targets for a conditional move.  */
-  vec<rtx> targets = vNULL;
+  auto_vec<rtx> targets;
   /* The temporaries introduced to allow us to not consider register
      overlap.  */
-  vec<rtx> temporaries = vNULL;
+  auto_vec<rtx> temporaries;
   /* The insns we've emitted.  */
-  vec<rtx_insn *> unmodified_insns = vNULL;
+  auto_vec<rtx_insn *> unmodified_insns;
   int count = 0;
 
   FOR_BB_INSNS (then_bb, insn)
@@ -3161,6 +3161,8 @@ noce_convert_multiple_sets (struct noce_if_info *if_info)
       set_used_flags (targets[i]);
     }
 
+  temporaries.release ();
+
   set_used_flags (cond);
   set_used_flags (x);
   set_used_flags (y);
diff --git a/gcc/lra-lives.c b/gcc/lra-lives.c
index 1655c47..9453759 100644
--- a/gcc/lra-lives.c
+++ b/gcc/lra-lives.c
@@ -103,7 +103,7 @@ free_live_range_list (lra_live_range_t lr)
   while (lr != NULL)
     {
       next = lr->next;
-      delete lr;
+      lra_live_range_pool.remove (lr);
       lr = next;
     }
 }
@@ -112,7 +112,7 @@ free_live_range_list (lra_live_range_t lr)
 static lra_live_range_t
 create_live_range (int regno, int start, int finish, lra_live_range_t next)
 {
-  lra_live_range_t p = new lra_live_range;
+  lra_live_range_t p = lra_live_range_pool.allocate ();
   p->regno = regno;
   p->start = start;
   p->finish = finish;
@@ -124,7 +124,7 @@ create_live_range (int regno, int start, int finish, lra_live_range_t next)
 static lra_live_range_t
 copy_live_range (lra_live_range_t r)
 {
-  return new lra_live_range (*r);
+  return new (lra_live_range_pool) lra_live_range (*r);
 }
 
 /* Copy live range list given by its head R and return the result.  */
@@ -167,7 +167,7 @@ lra_merge_live_ranges (lra_live_range_t r1, lra_live_range_t r2)
 	  r1->start = r2->start;
 	  lra_live_range_t temp = r2;
 	  r2 = r2->next;
-	  delete temp;
+	  lra_live_range_pool.remove (temp);
 	}
       else
 	{
@@ -1081,7 +1081,7 @@ remove_some_program_points_and_update_live_ranges (void)
 		}
 	      prev_r->start = r->start;
 	      prev_r->next = next_r;
-	      delete r;
+	      lra_live_range_pool.remove (r);
 	    }
 	}
     }
@@ -1240,7 +1240,9 @@ lra_create_live_ranges_1 (bool all_p, bool dead_insn_p)
   dead_set = sparseset_alloc (max_regno);
   unused_set = sparseset_alloc (max_regno);
   curr_point = 0;
-  point_freq_vec.create (get_max_uid () * 2);
+  unsigned new_length = get_max_uid () * 2;
+  if (point_freq_vec.length () < new_length)
+    point_freq_vec.safe_grow (new_length);
   lra_point_freq = point_freq_vec.address ();
   int *post_order_rev_cfg = XNEWVEC (int, last_basic_block_for_fn (cfun));
   int n_blocks_inverted = inverted_post_order_compute (post_order_rev_cfg);
diff --git a/gcc/tree-eh.c b/gcc/tree-eh.c
index 617d657..9f68f31 100644
--- a/gcc/tree-eh.c
+++ b/gcc/tree-eh.c
@@ -1362,7 +1362,7 @@ lower_try_finally_switch (struct leh_state *state, struct leh_tf_state *tf)
   int return_index, eh_index, fallthru_index;
   int nlabels, ndests, j, last_case_index;
   tree last_case;
-  vec<tree> case_label_vec;
+  auto_vec<tree> case_label_vec;
   gimple_seq switch_body = NULL;
   gimple *x;
   geh_else *eh_else;
diff --git a/gcc/tree-sra.c b/gcc/tree-sra.c
index a896308..30aee19 100644
--- a/gcc/tree-sra.c
+++ b/gcc/tree-sra.c
@@ -674,6 +674,12 @@ sra_deinitialize (void)
   assign_link_pool.release ();
   obstack_free (&name_obstack, NULL);
 
+  /* TODO: hash_map does not support traits that can release
+     value type of the hash_map.  */
+  for (hash_map<tree, auto_vec<access_p> >::iterator it =
+       base_access_vec->begin (); it != base_access_vec->end (); ++it)
+    (*it).second.release ();
+
   delete base_access_vec;
 }
 
diff --git a/gcc/tree-ssa-dom.c b/gcc/tree-ssa-dom.c
index 3887bbe1..5cb2644 100644
--- a/gcc/tree-ssa-dom.c
+++ b/gcc/tree-ssa-dom.c
@@ -121,8 +121,8 @@ static void dump_dominator_optimization_stats (FILE *file,
 
 /* Free the edge_info data attached to E, if it exists.  */
 
-static void
-free_edge_info (edge e)
+void
+free_dom_edge_info (edge e)
 {
   struct edge_info *edge_info = (struct edge_info *)e->aux;
 
@@ -142,7 +142,7 @@ allocate_edge_info (edge e)
   struct edge_info *edge_info;
 
   /* Free the old one, if it exists.  */
-  free_edge_info (e);
+  free_dom_edge_info (e);
 
   edge_info = XCNEW (struct edge_info);
 
@@ -167,7 +167,7 @@ free_all_edge_infos (void)
     {
       FOR_EACH_EDGE (e, ei, bb->preds)
         {
-	  free_edge_info (e);
+	  free_dom_edge_info (e);
 	  e->aux = NULL;
 	}
     }
diff --git a/gcc/tree-ssa-threadupdate.c b/gcc/tree-ssa-threadupdate.c
index 184cf34..c527206 100644
--- a/gcc/tree-ssa-threadupdate.c
+++ b/gcc/tree-ssa-threadupdate.c
@@ -290,7 +290,10 @@ remove_ctrl_stmt_and_useless_edges (basic_block bb, basic_block dest_bb)
   for (ei = ei_start (bb->succs); (e = ei_safe_edge (ei)); )
     {
       if (e->dest != dest_bb)
-	remove_edge (e);
+	{
+	  free_dom_edge_info (e);
+	  remove_edge (e);
+	}
       else
 	ei_next (&ei);
     }
@@ -2522,6 +2525,7 @@ thread_through_all_blocks (bool may_peel_loop_headers)
 
       delete_jump_thread_path (path);
       paths.unordered_remove (i);
+      free (region);
     }
 
   /* Remove from PATHS all the jump-threads starting with an edge already
diff --git a/gcc/tree-ssa-threadupdate.h b/gcc/tree-ssa-threadupdate.h
index 984b6c4..e0eb3f5 100644
--- a/gcc/tree-ssa-threadupdate.h
+++ b/gcc/tree-ssa-threadupdate.h
@@ -46,4 +46,5 @@ extern void register_jump_thread (vec <class jump_thread_edge *> *);
 extern void remove_jump_threads_including (edge);
 extern void delete_jump_thread_path (vec <class jump_thread_edge *> *);
 extern void remove_ctrl_stmt_and_useless_edges (basic_block, basic_block);
+extern void free_dom_edge_info (edge);
 #endif
-- 
2.6.2


^ permalink raw reply	[flat|nested] 42+ messages in thread

* [PATCH] 02/N Fix memory leaks in IPA
  2015-11-09 11:22 [PATCH] Fix memory leaks and use a pool_allocator Martin Liška
  2015-11-09 12:11 ` Richard Biener
@ 2015-11-09 13:29 ` Martin Liška
  2015-11-09 14:25   ` Richard Biener
  2015-11-11  9:04 ` [PATCH 03/N] Just another set of memory leaks Martin Liška
                   ` (4 subsequent siblings)
  6 siblings, 1 reply; 42+ messages in thread
From: Martin Liška @ 2015-11-09 13:29 UTC (permalink / raw)
  To: GCC Patches; +Cc: Martin Jambor, Richard Biener

[-- Attachment #1: Type: text/plain, Size: 236 bytes --]

Hi.

Following changes were consulted with Martin Jambor to properly release
memory in IPA. It fixes leaks which popped up in tramp3d with -O2.

Bootstrap and regression tests have been running.

Ready after it finishes?
Thanks,
Martin

[-- Attachment #2: 0002-Fix-memory-leaks-in-IPA.patch --]
[-- Type: text/x-patch, Size: 3027 bytes --]

From 85b63f738030dd7a901c228ba76e24f820d31c5d Mon Sep 17 00:00:00 2001
From: marxin <mliska@suse.cz>
Date: Mon, 9 Nov 2015 12:38:27 +0100
Subject: [PATCH 2/2] Fix memory leaks in IPA.

gcc/ChangeLog:

2015-11-09  Martin Liska  <mliska@suse.cz>

	* ipa-inline-analysis.c (estimate_function_body_sizes): Call
	body_info release function.
	* ipa-prop.c (ipa_release_body_info): New function.
	(ipa_analyze_node): Call the function.
	(ipa_node_params::~ipa_node_params): Release known_csts.
	* ipa-prop.h (ipa_release_body_info): Declare.
---
 gcc/ipa-inline-analysis.c |  2 +-
 gcc/ipa-prop.c            | 20 +++++++++++++++-----
 gcc/ipa-prop.h            |  2 +-
 3 files changed, 17 insertions(+), 7 deletions(-)

diff --git a/gcc/ipa-inline-analysis.c b/gcc/ipa-inline-analysis.c
index c07b0da..8c8b8e3 100644
--- a/gcc/ipa-inline-analysis.c
+++ b/gcc/ipa-inline-analysis.c
@@ -2853,7 +2853,7 @@ estimate_function_body_sizes (struct cgraph_node *node, bool early)
   inline_summaries->get (node)->self_time = time;
   inline_summaries->get (node)->self_size = size;
   nonconstant_names.release ();
-  fbi.bb_infos.release ();
+  ipa_release_body_info (&fbi);
   if (opt_for_fn (node->decl, optimize))
     {
       if (!early)
diff --git a/gcc/ipa-prop.c b/gcc/ipa-prop.c
index d15f0eb..f379ea7 100644
--- a/gcc/ipa-prop.c
+++ b/gcc/ipa-prop.c
@@ -2258,6 +2258,19 @@ analysis_dom_walker::before_dom_children (basic_block bb)
   ipa_compute_jump_functions_for_bb (m_fbi, bb);
 }
 
+/* Release body info FBI.  */
+
+void
+ipa_release_body_info (struct ipa_func_body_info *fbi)
+{
+  int i;
+  struct ipa_bb_info *bi;
+
+  FOR_EACH_VEC_ELT (fbi->bb_infos, i, bi)
+    free_ipa_bb_info (bi);
+  fbi->bb_infos.release ();
+}
+
 /* Initialize the array describing properties of formal parameters
    of NODE, analyze their uses and compute jump functions associated
    with actual arguments of calls from within NODE.  */
@@ -2313,11 +2326,7 @@ ipa_analyze_node (struct cgraph_node *node)
 
   analysis_dom_walker (&fbi).walk (ENTRY_BLOCK_PTR_FOR_FN (cfun));
 
-  int i;
-  struct ipa_bb_info *bi;
-  FOR_EACH_VEC_ELT (fbi.bb_infos, i, bi)
-    free_ipa_bb_info (bi);
-  fbi.bb_infos.release ();
+  ipa_release_body_info (&fbi);
   free_dominance_info (CDI_DOMINATORS);
   pop_cfun ();
 }
@@ -3306,6 +3315,7 @@ ipa_node_params::~ipa_node_params ()
   free (lattices);
   /* Lattice values and their sources are deallocated with their alocation
      pool.  */
+  known_csts.release ();
   known_contexts.release ();
 
   lattices = NULL;
diff --git a/gcc/ipa-prop.h b/gcc/ipa-prop.h
index b69ee8a..2fe824d 100644
--- a/gcc/ipa-prop.h
+++ b/gcc/ipa-prop.h
@@ -775,7 +775,7 @@ bool ipa_modify_expr (tree *, bool, ipa_parm_adjustment_vec);
 ipa_parm_adjustment *ipa_get_adjustment_candidate (tree **, bool *,
 						   ipa_parm_adjustment_vec,
 						   bool);
-
+void ipa_release_body_info (struct ipa_func_body_info *);
 
 /* From tree-sra.c:  */
 tree build_ref_for_offset (location_t, tree, HOST_WIDE_INT, bool, tree,
-- 
2.6.2


^ permalink raw reply	[flat|nested] 42+ messages in thread

* Re: [PATCH] Fix memory leaks and use a pool_allocator
  2015-11-09 13:26   ` Martin Liška
@ 2015-11-09 14:24     ` Richard Biener
  2015-11-11 11:18       ` [PATCH] Fix PR rtl-optimization/68287 Martin Liška
  0 siblings, 1 reply; 42+ messages in thread
From: Richard Biener @ 2015-11-09 14:24 UTC (permalink / raw)
  To: Martin Liška; +Cc: GCC Patches

On Mon, Nov 9, 2015 at 2:26 PM, Martin Liška <mliska@suse.cz> wrote:
> On 11/09/2015 01:11 PM, Richard Biener wrote:
>> On Mon, Nov 9, 2015 at 12:22 PM, Martin Liška <mliska@suse.cz> wrote:
>>> Hi.
>>>
>>> This is follow-up of changes that Richi started on Friday.
>>>
>>> Patch can bootstrap on x86_64-linux-pc and regression tests are running.
>>>
>>> Ready for trunk?
>>
>>         * tree-ssa-dom.c (free_edge_info): Make the function extern.
>> ...
>>         * tree-ssa.h (free_edge_info): Declare function extern.
>>
>> declare this in tree-ssa-threadupdate.h instead and renaming it to
>> sth less "public", like free_dom_edge_info.
>>
>> diff --git a/gcc/ifcvt.c b/gcc/ifcvt.c
>> index fff62de..eb6b7df 100644
>> --- a/gcc/ifcvt.c
>> +++ b/gcc/ifcvt.c
>> @@ -3161,6 +3161,8 @@ noce_convert_multiple_sets (struct noce_if_info *if_info)
>>        set_used_flags (targets[i]);
>>      }
>>
>> +  temporaries.release ();
>> +
>>    set_used_flags (cond);
>>    set_used_flags (x);
>>    set_used_flags (y);
>> @@ -3194,6 +3196,7 @@ noce_convert_multiple_sets (struct noce_if_info *if_info)
>>      }
>>
>>    num_updated_if_blocks++;
>> +  targets.release ();
>>    return TRUE;
>>
>> suspiciously look like candidates for an auto_vec<> (didn't check).
>>
>> @@ -1240,6 +1240,7 @@ lra_create_live_ranges_1 (bool all_p, bool dead_insn_p)
>>    dead_set = sparseset_alloc (max_regno);
>>    unused_set = sparseset_alloc (max_regno);
>>    curr_point = 0;
>> +  point_freq_vec.release ();
>>    point_freq_vec.create (get_max_uid () * 2);
>>
>> a truncate (0) instead of a release () should be cheaper, avoiding the
>> re-allocation.
>>
>> @@ -674,6 +674,10 @@ sra_deinitialize (void)
>>    assign_link_pool.release ();
>>    obstack_free (&name_obstack, NULL);
>>
>> +  for (hash_map<tree, auto_vec<access_p> >::iterator it =
>> +       base_access_vec->begin (); it != base_access_vec->end (); ++it)
>> +    (*it).second.release ();
>> +
>>    delete base_access_vec;
>>
>> I wonder if the better fix is to provide a proper free method for the hash_map?
>> A hash_map with 'auto_vec' looks suspicous - eventually a proper release
>> was intented here via default_hash_map_traits <>?
>>
>> Anyway, most of the things above can be improved as followup of course.
>>
>> Thanks,
>> Richard.
>>
>>> Thanks,
>>> Martin
>
> Hi.
>
> All suggested changes were applied, sending v2 and waiting for bootstrap and
> regression tests.

Ok.

Thanks,
Richard.

> Thanks,
> Martin

^ permalink raw reply	[flat|nested] 42+ messages in thread

* Re: [PATCH] 02/N Fix memory leaks in IPA
  2015-11-09 13:29 ` [PATCH] 02/N Fix memory leaks in IPA Martin Liška
@ 2015-11-09 14:25   ` Richard Biener
  0 siblings, 0 replies; 42+ messages in thread
From: Richard Biener @ 2015-11-09 14:25 UTC (permalink / raw)
  To: Martin Liška; +Cc: GCC Patches, Martin Jambor

On Mon, Nov 9, 2015 at 2:29 PM, Martin Liška <mliska@suse.cz> wrote:
> Hi.
>
> Following changes were consulted with Martin Jambor to properly release
> memory in IPA. It fixes leaks which popped up in tramp3d with -O2.
>
> Bootstrap and regression tests have been running.
>
> Ready after it finishes?

Ok.

Richard.

> Thanks,
> Martin

^ permalink raw reply	[flat|nested] 42+ messages in thread

* [PATCH 03/N] Just another set of memory leaks
  2015-11-09 11:22 [PATCH] Fix memory leaks and use a pool_allocator Martin Liška
  2015-11-09 12:11 ` Richard Biener
  2015-11-09 13:29 ` [PATCH] 02/N Fix memory leaks in IPA Martin Liška
@ 2015-11-11  9:04 ` Martin Liška
  2015-11-11 10:24   ` Richard Biener
  2015-11-12 10:03 ` [PATCH 04/N] Fix big memory leak in ix86_valid_target_attribute_p Martin Liška
                   ` (3 subsequent siblings)
  6 siblings, 1 reply; 42+ messages in thread
From: Martin Liška @ 2015-11-11  9:04 UTC (permalink / raw)
  To: gcc-patches

[-- Attachment #1: Type: text/plain, Size: 2742 bytes --]

Hi.

There are new fixed for memory leaks, where the following:

==19826== 21 bytes in 1 blocks are definitely lost in loss record 16 of 625
==19826==    at 0x4C2A00F: malloc (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so)
==19826==    by 0x16868D7: xmalloc (xmalloc.c:148)
==19826==    by 0x167FDFB: concat (concat.c:147)
==19826==    by 0x932920: gcc::dump_manager::get_dump_file_name(dump_file_info*) const (dumpfile.c:292)
==19826==    by 0x932821: gcc::dump_manager::get_dump_file_name(int) const (dumpfile.c:253)
==19826==    by 0xC1BBEA: pass_init_dump_file(opt_pass*) (passes.c:2074)
==19826==    by 0xC1C31B: execute_one_pass(opt_pass*) (passes.c:2302)
==19826==    by 0xC1D25E: execute_ipa_pass_list(opt_pass*) (passes.c:2735)
==19826==    by 0x8EED23: symbol_table::compile() (cgraphunit.c:2411)
==19826==    by 0x8EEF93: symbol_table::finalize_compilation_unit() (cgraphunit.c:2540)
==19826==    by 0xD205EE: compile_file() (toplev.c:491)
==19826==    by 0xD229AF: do_compile() (toplev.c:1954)

happens in context:

(gdb) p dump_file_name
$1 = 0x23e46d0 "ipa-pta-1.c.067i.pta"
(gdb) c
Continuing.

Breakpoint 2, pass_init_dump_file (pass=0x238c7c0) at ../../gcc/passes.c:2074
2074	      dump_file_name = dumps->get_dump_file_name (pass->static_pass_number);
(gdb) bt
#0  pass_init_dump_file (pass=0x238c7c0) at ../../gcc/passes.c:2074
#1  0x0000000000c1bebe in execute_one_ipa_transform_pass (node=0x7ffff6a01450, ipa_pass=0x238c7c0) at ../../gcc/passes.c:2172
#2  0x0000000000c1c07f in execute_all_ipa_transforms () at ../../gcc/passes.c:2223
#3  0x00000000008e39e0 in cgraph_node::get_body (this=0x7ffff6a01450) at ../../gcc/cgraph.c:3299
#4  0x0000000000f1469f in ipa_pta_execute () at ../../gcc/tree-ssa-structalias.c:7344
#5  0x0000000000f15465 in (anonymous namespace)::pass_ipa_pta::execute (this=0x238cb50) at ../../gcc/tree-ssa-structalias.c:7664
#6  0x0000000000c1c384 in execute_one_pass (pass=0x238cb50) at ../../gcc/passes.c:2316
#7  0x0000000000c1d25f in execute_ipa_pass_list (pass=0x238cb50) at ../../gcc/passes.c:2735
#8  0x00000000008eed24 in symbol_table::compile (this=0x7ffff68d30a8) at ../../gcc/cgraphunit.c:2411
#9  0x00000000008eef94 in symbol_table::finalize_compilation_unit (this=0x7ffff68d30a8) at ../../gcc/cgraphunit.c:2540
#10 0x0000000000d205ef in compile_file () at ../../gcc/toplev.c:491
#11 0x0000000000d229b0 in do_compile () at ../../gcc/toplev.c:1954
#12 0x0000000000d22c2f in toplev::main (this=0x7fffffffd910, argc=23, argv=0x7fffffffda18) at ../../gcc/toplev.c:2061
#13 0x0000000001619ad4 in main (argc=23, argv=0x7fffffffda18) at ../../gcc/main.c:39

Rest should be quite obvious.

Bootstrap and regression tests have been running.

Ready to install after it finishes?
Martin

[-- Attachment #2: 0001-Fix-various-memory-leaks.patch --]
[-- Type: text/x-patch, Size: 3961 bytes --]

From 96dfceff2522b352d465016b48da4ea42e9e3ffc Mon Sep 17 00:00:00 2001
From: marxin <mliska@suse.cz>
Date: Tue, 10 Nov 2015 17:32:31 +0100
Subject: [PATCH 1/2] Fix various memory leaks

gcc/ChangeLog:

2015-11-11  Martin Liska  <mliska@suse.cz>

	* gimple-ssa-strength-reduction.c (create_phi_basis):
	Use auto_vec.
	* passes.c (release_dump_file_name): New function.
	(pass_init_dump_file): Used from this function.
	(pass_fini_dump_file): Likewise.
	* tree-sra.c (convert_callers_for_node): Use xstrdup_for_dump.
	* var-tracking.c (vt_initialize): Use pool_allocator.
---
 gcc/gimple-ssa-strength-reduction.c |  3 +--
 gcc/passes.c                        | 19 ++++++++++++++-----
 gcc/tree-sra.c                      |  4 ++--
 gcc/var-tracking.c                  |  2 +-
 4 files changed, 18 insertions(+), 10 deletions(-)

diff --git a/gcc/gimple-ssa-strength-reduction.c b/gcc/gimple-ssa-strength-reduction.c
index ce32ad3..b807823 100644
--- a/gcc/gimple-ssa-strength-reduction.c
+++ b/gcc/gimple-ssa-strength-reduction.c
@@ -2226,12 +2226,11 @@ create_phi_basis (slsr_cand_t c, gimple *from_phi, tree basis_name,
   int i;
   tree name, phi_arg;
   gphi *phi;
-  vec<tree> phi_args;
   slsr_cand_t basis = lookup_cand (c->basis);
   int nargs = gimple_phi_num_args (from_phi);
   basic_block phi_bb = gimple_bb (from_phi);
   slsr_cand_t phi_cand = base_cand_from_table (gimple_phi_result (from_phi));
-  phi_args.create (nargs);
+  auto_vec<tree> phi_args (nargs);
 
   /* Process each argument of the existing phi that represents
      conditionally-executed add candidates.  */
diff --git a/gcc/passes.c b/gcc/passes.c
index 7a10cb6..dd8d00a 100644
--- a/gcc/passes.c
+++ b/gcc/passes.c
@@ -2058,6 +2058,18 @@ verify_curr_properties (function *fn, void *data)
   gcc_assert ((fn->curr_properties & props) == props);
 }
 
+/* Release dump file name if set.  */
+
+static void
+release_dump_file_name (void)
+{
+  if (dump_file_name)
+    {
+      free (CONST_CAST (char *, dump_file_name));
+      dump_file_name = NULL;
+    }
+}
+
 /* Initialize pass dump file.  */
 /* This is non-static so that the plugins can use it.  */
 
@@ -2071,6 +2083,7 @@ pass_init_dump_file (opt_pass *pass)
       gcc::dump_manager *dumps = g->get_dumps ();
       bool initializing_dump =
 	!dumps->dump_initialized_p (pass->static_pass_number);
+      release_dump_file_name ();
       dump_file_name = dumps->get_dump_file_name (pass->static_pass_number);
       dumps->dump_start (pass->static_pass_number, &dump_flags);
       if (dump_file && current_function_decl)
@@ -2098,11 +2111,7 @@ pass_fini_dump_file (opt_pass *pass)
   timevar_push (TV_DUMP);
 
   /* Flush and close dump file.  */
-  if (dump_file_name)
-    {
-      free (CONST_CAST (char *, dump_file_name));
-      dump_file_name = NULL;
-    }
+  release_dump_file_name ();
 
   g->get_dumps ()->dump_finish (pass->static_pass_number);
   timevar_pop (TV_DUMP);
diff --git a/gcc/tree-sra.c b/gcc/tree-sra.c
index 30aee19..2835c99 100644
--- a/gcc/tree-sra.c
+++ b/gcc/tree-sra.c
@@ -4996,9 +4996,9 @@ convert_callers_for_node (struct cgraph_node *node,
 
       if (dump_file)
 	fprintf (dump_file, "Adjusting call %s/%i -> %s/%i\n",
-		 xstrdup (cs->caller->name ()),
+		 xstrdup_for_dump (cs->caller->name ()),
 		 cs->caller->order,
-		 xstrdup (cs->callee->name ()),
+		 xstrdup_for_dump (cs->callee->name ()),
 		 cs->callee->order);
 
       ipa_modify_call_arguments (cs, cs->call_stmt, *adjustments);
diff --git a/gcc/var-tracking.c b/gcc/var-tracking.c
index 388b534..9185bfd 100644
--- a/gcc/var-tracking.c
+++ b/gcc/var-tracking.c
@@ -9814,7 +9814,7 @@ vt_initialize (void)
 
   alloc_aux_for_blocks (sizeof (variable_tracking_info));
 
-  empty_shared_hash = new shared_hash;
+  empty_shared_hash = shared_hash_pool.allocate ();
   empty_shared_hash->refcount = 1;
   empty_shared_hash->htab = new variable_table_type (1);
   changed_variables = new variable_table_type (10);
-- 
2.6.2


^ permalink raw reply	[flat|nested] 42+ messages in thread

* Re: [PATCH 03/N] Just another set of memory leaks
  2015-11-11  9:04 ` [PATCH 03/N] Just another set of memory leaks Martin Liška
@ 2015-11-11 10:24   ` Richard Biener
  0 siblings, 0 replies; 42+ messages in thread
From: Richard Biener @ 2015-11-11 10:24 UTC (permalink / raw)
  To: Martin Liška; +Cc: GCC Patches

On Wed, Nov 11, 2015 at 10:04 AM, Martin Liška <mliska@suse.cz> wrote:
> Hi.
>
> There are new fixed for memory leaks, where the following:
>
> ==19826== 21 bytes in 1 blocks are definitely lost in loss record 16 of 625
> ==19826==    at 0x4C2A00F: malloc (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so)
> ==19826==    by 0x16868D7: xmalloc (xmalloc.c:148)
> ==19826==    by 0x167FDFB: concat (concat.c:147)
> ==19826==    by 0x932920: gcc::dump_manager::get_dump_file_name(dump_file_info*) const (dumpfile.c:292)
> ==19826==    by 0x932821: gcc::dump_manager::get_dump_file_name(int) const (dumpfile.c:253)
> ==19826==    by 0xC1BBEA: pass_init_dump_file(opt_pass*) (passes.c:2074)
> ==19826==    by 0xC1C31B: execute_one_pass(opt_pass*) (passes.c:2302)
> ==19826==    by 0xC1D25E: execute_ipa_pass_list(opt_pass*) (passes.c:2735)
> ==19826==    by 0x8EED23: symbol_table::compile() (cgraphunit.c:2411)
> ==19826==    by 0x8EEF93: symbol_table::finalize_compilation_unit() (cgraphunit.c:2540)
> ==19826==    by 0xD205EE: compile_file() (toplev.c:491)
> ==19826==    by 0xD229AF: do_compile() (toplev.c:1954)
>
> happens in context:
>
> (gdb) p dump_file_name
> $1 = 0x23e46d0 "ipa-pta-1.c.067i.pta"
> (gdb) c
> Continuing.
>
> Breakpoint 2, pass_init_dump_file (pass=0x238c7c0) at ../../gcc/passes.c:2074
> 2074          dump_file_name = dumps->get_dump_file_name (pass->static_pass_number);
> (gdb) bt
> #0  pass_init_dump_file (pass=0x238c7c0) at ../../gcc/passes.c:2074
> #1  0x0000000000c1bebe in execute_one_ipa_transform_pass (node=0x7ffff6a01450, ipa_pass=0x238c7c0) at ../../gcc/passes.c:2172
> #2  0x0000000000c1c07f in execute_all_ipa_transforms () at ../../gcc/passes.c:2223
> #3  0x00000000008e39e0 in cgraph_node::get_body (this=0x7ffff6a01450) at ../../gcc/cgraph.c:3299
> #4  0x0000000000f1469f in ipa_pta_execute () at ../../gcc/tree-ssa-structalias.c:7344
> #5  0x0000000000f15465 in (anonymous namespace)::pass_ipa_pta::execute (this=0x238cb50) at ../../gcc/tree-ssa-structalias.c:7664
> #6  0x0000000000c1c384 in execute_one_pass (pass=0x238cb50) at ../../gcc/passes.c:2316
> #7  0x0000000000c1d25f in execute_ipa_pass_list (pass=0x238cb50) at ../../gcc/passes.c:2735
> #8  0x00000000008eed24 in symbol_table::compile (this=0x7ffff68d30a8) at ../../gcc/cgraphunit.c:2411
> #9  0x00000000008eef94 in symbol_table::finalize_compilation_unit (this=0x7ffff68d30a8) at ../../gcc/cgraphunit.c:2540
> #10 0x0000000000d205ef in compile_file () at ../../gcc/toplev.c:491
> #11 0x0000000000d229b0 in do_compile () at ../../gcc/toplev.c:1954
> #12 0x0000000000d22c2f in toplev::main (this=0x7fffffffd910, argc=23, argv=0x7fffffffda18) at ../../gcc/toplev.c:2061
> #13 0x0000000001619ad4 in main (argc=23, argv=0x7fffffffda18) at ../../gcc/main.c:39
>
> Rest should be quite obvious.
>
> Bootstrap and regression tests have been running.
>
> Ready to install after it finishes?

Ok.

Richard.

> Martin

^ permalink raw reply	[flat|nested] 42+ messages in thread

* [PATCH] Fix PR rtl-optimization/68287
  2015-11-09 14:24     ` Richard Biener
@ 2015-11-11 11:18       ` Martin Liška
  2015-11-11 12:20         ` Richard Biener
  0 siblings, 1 reply; 42+ messages in thread
From: Martin Liška @ 2015-11-11 11:18 UTC (permalink / raw)
  To: Richard Biener; +Cc: GCC Patches

[-- Attachment #1: Type: text/plain, Size: 148 bytes --]

Hi.

There's a fix for fallout of r230027.

Patch can bootstrap and survives regression tests on x86_64-linux-gnu.

Ready for trunk?
Thanks,
Martin

[-- Attachment #2: 0001-Fix-PR-rtl-optimization-68287.patch --]
[-- Type: text/x-patch, Size: 1043 bytes --]

From 127d629991d92ea42a87b84e9d88612b84dbec03 Mon Sep 17 00:00:00 2001
From: marxin <mliska@suse.cz>
Date: Wed, 11 Nov 2015 10:11:20 +0100
Subject: [PATCH 1/2] Fix PR rtl-optimization/68287

gcc/ChangeLog:

2015-11-11  Martin Liska  <mliska@suse.cz>

	PR rtl-optimization/68287
	* lra-lives.c (lra_create_live_ranges_1): Clear the vector
	with zeros.
---
 gcc/lra-lives.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/gcc/lra-lives.c b/gcc/lra-lives.c
index 9453759..27887de 100644
--- a/gcc/lra-lives.c
+++ b/gcc/lra-lives.c
@@ -1242,7 +1242,7 @@ lra_create_live_ranges_1 (bool all_p, bool dead_insn_p)
   curr_point = 0;
   unsigned new_length = get_max_uid () * 2;
   if (point_freq_vec.length () < new_length)
-    point_freq_vec.safe_grow (new_length);
+    point_freq_vec.safe_grow_cleared (new_length);
   lra_point_freq = point_freq_vec.address ();
   int *post_order_rev_cfg = XNEWVEC (int, last_basic_block_for_fn (cfun));
   int n_blocks_inverted = inverted_post_order_compute (post_order_rev_cfg);
-- 
2.6.2


^ permalink raw reply	[flat|nested] 42+ messages in thread

* Re: [PATCH] Fix PR rtl-optimization/68287
  2015-11-11 11:18       ` [PATCH] Fix PR rtl-optimization/68287 Martin Liška
@ 2015-11-11 12:20         ` Richard Biener
  2015-11-11 12:41           ` Martin Liška
  0 siblings, 1 reply; 42+ messages in thread
From: Richard Biener @ 2015-11-11 12:20 UTC (permalink / raw)
  To: Martin Liška; +Cc: GCC Patches

On Wed, Nov 11, 2015 at 12:18 PM, Martin Liška <mliska@suse.cz> wrote:
> Hi.
>
> There's a fix for fallout of r230027.
>
> Patch can bootstrap and survives regression tests on x86_64-linux-gnu.

Hmm, but only the new elements are zeroed so this still is different
from previous behavior.
Note that the previous .create (...) doesn't initialize the elements
either (well, it's not supposed to ...).

I _think_ the bug is that you do safe_grow and use length while the
previous code just added
enough reserve (but not actual elements!).

Thus the fix would be to do

 point_freq_vec.truncate (0);
 point_freq_vec.reserve_exact (new_length);

Richard.

> Ready for trunk?
> Thanks,
> Martin

^ permalink raw reply	[flat|nested] 42+ messages in thread

* Re: [PATCH] Fix PR rtl-optimization/68287
  2015-11-11 12:20         ` Richard Biener
@ 2015-11-11 12:41           ` Martin Liška
  0 siblings, 0 replies; 42+ messages in thread
From: Martin Liška @ 2015-11-11 12:41 UTC (permalink / raw)
  To: gcc-patches; +Cc: Richard Biener

[-- Attachment #1: Type: text/plain, Size: 961 bytes --]

On 11/11/2015 01:20 PM, Richard Biener wrote:
> On Wed, Nov 11, 2015 at 12:18 PM, Martin Liška <mliska@suse.cz> wrote:
>> Hi.
>>
>> There's a fix for fallout of r230027.
>>
>> Patch can bootstrap and survives regression tests on x86_64-linux-gnu.
> 
> Hmm, but only the new elements are zeroed so this still is different
> from previous behavior.
> Note that the previous .create (...) doesn't initialize the elements
> either (well, it's not supposed to ...).
> 
> I _think_ the bug is that you do safe_grow and use length while the
> previous code just added
> enough reserve (but not actual elements!).
> 
> Thus the fix would be to do
> 
>  point_freq_vec.truncate (0);
>  point_freq_vec.reserve_exact (new_length);
> 
> Richard.

Ahh, I see! Thanks for suggestion. I'm going to re-run regression
tests and bootstrap.

I consider previous email as confirmation for the patch to be installed.

Thanks,
Martin

> 
>> Ready for trunk?
>> Thanks,
>> Martin


[-- Attachment #2: 0001-Fix-PR-rtl-optimization-68287.patch --]
[-- Type: text/x-patch, Size: 1168 bytes --]

From f719039abd856962d4ab9c0e61994aba413aeffa Mon Sep 17 00:00:00 2001
From: marxin <mliska@suse.cz>
Date: Wed, 11 Nov 2015 10:11:20 +0100
Subject: [PATCH 1/3] Fix PR rtl-optimization/68287

gcc/ChangeLog:

2015-11-11  Martin Liska  <mliska@suse.cz>
	    Richard Biener  <rguenther@suse.de>

	PR rtl-optimization/68287
	* lra-lives.c (lra_create_live_ranges_1): Reserve the right
	number of elements.
---
 gcc/lra-lives.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/gcc/lra-lives.c b/gcc/lra-lives.c
index 9453759..5f76a87 100644
--- a/gcc/lra-lives.c
+++ b/gcc/lra-lives.c
@@ -1241,8 +1241,8 @@ lra_create_live_ranges_1 (bool all_p, bool dead_insn_p)
   unused_set = sparseset_alloc (max_regno);
   curr_point = 0;
   unsigned new_length = get_max_uid () * 2;
-  if (point_freq_vec.length () < new_length)
-    point_freq_vec.safe_grow (new_length);
+  point_freq_vec.truncate (0);
+  point_freq_vec.reserve_exact (new_length);
   lra_point_freq = point_freq_vec.address ();
   int *post_order_rev_cfg = XNEWVEC (int, last_basic_block_for_fn (cfun));
   int n_blocks_inverted = inverted_post_order_compute (post_order_rev_cfg);
-- 
2.6.2


^ permalink raw reply	[flat|nested] 42+ messages in thread

* [PATCH 04/N] Fix big memory leak in ix86_valid_target_attribute_p
  2015-11-09 11:22 [PATCH] Fix memory leaks and use a pool_allocator Martin Liška
                   ` (2 preceding siblings ...)
  2015-11-11  9:04 ` [PATCH 03/N] Just another set of memory leaks Martin Liška
@ 2015-11-12 10:03 ` Martin Liška
  2015-11-12 11:29   ` Richard Biener
  2015-11-13 11:43 ` [PATCH 05/N] Fix memory leaks in graphite Martin Liška
                   ` (2 subsequent siblings)
  6 siblings, 1 reply; 42+ messages in thread
From: Martin Liška @ 2015-11-12 10:03 UTC (permalink / raw)
  To: gcc-patches; +Cc: jakub

[-- Attachment #1: Type: text/plain, Size: 246 bytes --]

Hello.

Following patch was a bit negotiated with Jakub and can save a huge amount of memory in cases
where target attributes are heavily utilized.

Can bootstrap and survives regression tests on x86_64-linux-pc.

Ready for trunk?
Thanks,
Martin

[-- Attachment #2: 0001-Fix-big-memory-leak-in-ix86_valid_target_attribute_p.patch --]
[-- Type: text/x-patch, Size: 3293 bytes --]

From ebb7bd3cf513dc437622868eddbed6c8f725a67c Mon Sep 17 00:00:00 2001
From: marxin <mliska@suse.cz>
Date: Wed, 11 Nov 2015 12:52:11 +0100
Subject: [PATCH] Fix big memory leak in ix86_valid_target_attribute_p

---
 gcc/config/i386/i386.c |  2 ++
 gcc/gcc.c              |  2 +-
 gcc/lto-wrapper.c      |  2 +-
 gcc/opts-common.c      |  1 +
 gcc/opts.c             | 16 +++++++++++++++-
 gcc/opts.h             |  1 +
 6 files changed, 21 insertions(+), 3 deletions(-)

diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c
index b84a11d..1325cf0 100644
--- a/gcc/config/i386/i386.c
+++ b/gcc/config/i386/i386.c
@@ -6237,6 +6237,8 @@ ix86_valid_target_attribute_p (tree fndecl,
 	DECL_FUNCTION_SPECIFIC_OPTIMIZATION (fndecl) = new_optimize;
     }
 
+  finalize_options_struct (&func_options);
+
   return ret;
 }
 
diff --git a/gcc/gcc.c b/gcc/gcc.c
index 8bbf5be..87d1979 100644
--- a/gcc/gcc.c
+++ b/gcc/gcc.c
@@ -9915,7 +9915,7 @@ driver_get_configure_time_options (void (*cb) (const char *option,
   size_t i;
 
   obstack_init (&obstack);
-  gcc_obstack_init (&opts_obstack);
+  init_opts_obstack ();
   n_switches = 0;
 
   for (i = 0; i < ARRAY_SIZE (option_default_specs); i++)
diff --git a/gcc/lto-wrapper.c b/gcc/lto-wrapper.c
index 20e67ed..b9ac535 100644
--- a/gcc/lto-wrapper.c
+++ b/gcc/lto-wrapper.c
@@ -1355,7 +1355,7 @@ main (int argc, char *argv[])
 {
   const char *p;
 
-  gcc_obstack_init (&opts_obstack);
+  init_opts_obstack ();
 
   p = argv[0] + strlen (argv[0]);
   while (p != argv[0] && !IS_DIR_SEPARATOR (p[-1]))
diff --git a/gcc/opts-common.c b/gcc/opts-common.c
index d9bf4d4..06e88b5 100644
--- a/gcc/opts-common.c
+++ b/gcc/opts-common.c
@@ -706,6 +706,7 @@ decode_cmdline_option (const char **argv, unsigned int lang_mask,
 /* Obstack for option strings.  */
 
 struct obstack opts_obstack;
+bool opts_obstack_initialized = false;
 
 /* Like libiberty concat, but allocate using opts_obstack.  */
 
diff --git a/gcc/opts.c b/gcc/opts.c
index 9a3fbb3..527e678 100644
--- a/gcc/opts.c
+++ b/gcc/opts.c
@@ -266,6 +266,20 @@ add_comma_separated_to_vector (void **pvec, const char *arg)
   *pvec = v;
 }
 
+static bool opts_obstack_initialized = false;
+
+/* Initialize opts_obstack if not initialized.  */
+
+void
+init_opts_obstack (void)
+{
+  if (!opts_obstack_initialized)
+    {
+      opts_obstack_initialized = true;
+      gcc_obstack_init (&opts_obstack);
+    }
+}
+
 /* Initialize OPTS and OPTS_SET before using them in parsing options.  */
 
 void
@@ -273,7 +287,7 @@ init_options_struct (struct gcc_options *opts, struct gcc_options *opts_set)
 {
   size_t num_params = get_num_compiler_params ();
 
-  gcc_obstack_init (&opts_obstack);
+  init_opts_obstack ();
 
   *opts = global_options_init;
 
diff --git a/gcc/opts.h b/gcc/opts.h
index 38b3837..2eb2d97 100644
--- a/gcc/opts.h
+++ b/gcc/opts.h
@@ -323,6 +323,7 @@ extern void decode_cmdline_options_to_array (unsigned int argc,
 extern void init_options_once (void);
 extern void init_options_struct (struct gcc_options *opts,
 				 struct gcc_options *opts_set);
+extern void init_opts_obstack (void);
 extern void finalize_options_struct (struct gcc_options *opts);
 extern void decode_cmdline_options_to_array_default_mask (unsigned int argc,
 							  const char **argv, 
-- 
2.6.2


^ permalink raw reply	[flat|nested] 42+ messages in thread

* Re: [PATCH 04/N] Fix big memory leak in ix86_valid_target_attribute_p
  2015-11-12 10:03 ` [PATCH 04/N] Fix big memory leak in ix86_valid_target_attribute_p Martin Liška
@ 2015-11-12 11:29   ` Richard Biener
  2015-11-12 11:33     ` Bernd Schmidt
  2015-11-12 15:52     ` Martin Liška
  0 siblings, 2 replies; 42+ messages in thread
From: Richard Biener @ 2015-11-12 11:29 UTC (permalink / raw)
  To: Martin Liška; +Cc: GCC Patches, Jakub Jelinek

On Thu, Nov 12, 2015 at 11:03 AM, Martin Liška <mliska@suse.cz> wrote:
> Hello.
>
> Following patch was a bit negotiated with Jakub and can save a huge amount of memory in cases
> where target attributes are heavily utilized.
>
> Can bootstrap and survives regression tests on x86_64-linux-pc.
>
> Ready for trunk?

+static bool opts_obstack_initialized = false;
+
+/* Initialize opts_obstack if not initialized.  */
+
+void
+init_opts_obstack (void)
+{
+  if (!opts_obstack_initialized)
+    {
+      opts_obstack_initialized = true;
+      gcc_obstack_init (&opts_obstack);

you can move the static global to function scope.

Ok with that change.

Btw, don't other targets need a similar adjustment to their hook?
Grepping shows arm and nios2.

Thanks,
Richard.


> Thanks,
> Martin

^ permalink raw reply	[flat|nested] 42+ messages in thread

* Re: [PATCH 04/N] Fix big memory leak in ix86_valid_target_attribute_p
  2015-11-12 11:29   ` Richard Biener
@ 2015-11-12 11:33     ` Bernd Schmidt
  2015-11-12 15:38       ` Martin Liška
  2015-11-12 15:52     ` Martin Liška
  1 sibling, 1 reply; 42+ messages in thread
From: Bernd Schmidt @ 2015-11-12 11:33 UTC (permalink / raw)
  To: Richard Biener, Martin Liška; +Cc: GCC Patches, Jakub Jelinek

On 11/12/2015 12:29 PM, Richard Biener wrote:
> +static bool opts_obstack_initialized = false;
> +
> +/* Initialize opts_obstack if not initialized.  */
> +
> +void
> +init_opts_obstack (void)
> +{
> +  if (!opts_obstack_initialized)
> +    {
> +      opts_obstack_initialized = true;
> +      gcc_obstack_init (&opts_obstack);
>
> you can move the static global to function scope.

Also, why bother with it? Why not simply arrange to call the function 
just once at startup?

It's not clear from the submission why this is done and how it relates 
to the i386.c hunk.


Bernd

^ permalink raw reply	[flat|nested] 42+ messages in thread

* Re: [PATCH 04/N] Fix big memory leak in ix86_valid_target_attribute_p
  2015-11-12 11:33     ` Bernd Schmidt
@ 2015-11-12 15:38       ` Martin Liška
  0 siblings, 0 replies; 42+ messages in thread
From: Martin Liška @ 2015-11-12 15:38 UTC (permalink / raw)
  To: gcc-patches

On 11/12/2015 12:33 PM, Bernd Schmidt wrote:
> On 11/12/2015 12:29 PM, Richard Biener wrote:
>> +static bool opts_obstack_initialized = false;
>> +
>> +/* Initialize opts_obstack if not initialized.  */
>> +
>> +void
>> +init_opts_obstack (void)
>> +{
>> +  if (!opts_obstack_initialized)
>> +    {
>> +      opts_obstack_initialized = true;
>> +      gcc_obstack_init (&opts_obstack);
>>
>> you can move the static global to function scope.
> 
> Also, why bother with it? Why not simply arrange to call the function just once at startup?

Hello.

It's called from multiple locations:

$ git grep init_opts_obstack
gcc/gcc.c:  init_opts_obstack ();
gcc/lto-wrapper.c:  init_opts_obstack ();
gcc/opts.c:init_opts_obstack (void)
gcc/opts.c:  init_opts_obstack ();
gcc/opts.h:extern void init_opts_obstack (void);

Maybe there's a common ancestor of all paths, maybe it can be done as a follow-up.

> 
> It's not clear from the submission why this is done and how it relates to the i386.c hunk.

Sorry that the hunk isn't explained better, in fast this change is unrelated and fixed
another memory leak.

Thanks,
Martin

> 
> 
> Bernd

^ permalink raw reply	[flat|nested] 42+ messages in thread

* Re: [PATCH 04/N] Fix big memory leak in ix86_valid_target_attribute_p
  2015-11-12 11:29   ` Richard Biener
  2015-11-12 11:33     ` Bernd Schmidt
@ 2015-11-12 15:52     ` Martin Liška
  2015-11-12 15:58       ` Ramana Radhakrishnan
  1 sibling, 1 reply; 42+ messages in thread
From: Martin Liška @ 2015-11-12 15:52 UTC (permalink / raw)
  To: Richard Biener; +Cc: GCC Patches, Jakub Jelinek

[-- Attachment #1: Type: text/plain, Size: 1141 bytes --]

On 11/12/2015 12:29 PM, Richard Biener wrote:
> On Thu, Nov 12, 2015 at 11:03 AM, Martin Liška <mliska@suse.cz> wrote:
>> Hello.
>>
>> Following patch was a bit negotiated with Jakub and can save a huge amount of memory in cases
>> where target attributes are heavily utilized.
>>
>> Can bootstrap and survives regression tests on x86_64-linux-pc.
>>
>> Ready for trunk?
> 
> +static bool opts_obstack_initialized = false;
> +
> +/* Initialize opts_obstack if not initialized.  */
> +
> +void
> +init_opts_obstack (void)
> +{
> +  if (!opts_obstack_initialized)
> +    {
> +      opts_obstack_initialized = true;
> +      gcc_obstack_init (&opts_obstack);
> 
> you can move the static global to function scope.
> 
> Ok with that change.

Done and installed as r230264. Final version of the patch is attached.

> 
> Btw, don't other targets need a similar adjustment to their hook?
> Grepping shows arm and nios2.

nios2 is not the case as it doesn't utilize:
  init_options_struct (&func_options, NULL);

I've been testing patch for aarch64 that is also included in the email.

Martin

> 
> Thanks,
> Richard.
> 
> 
>> Thanks,
>> Martin


[-- Attachment #2: 0001-Fix-big-memory-leak-in-ix86_valid_target_attribute_p.patch --]
[-- Type: text/x-patch, Size: 3306 bytes --]

From 2a7ed80a489228bbb3c271ca9d0217cca888eeae Mon Sep 17 00:00:00 2001
From: marxin <mliska@suse.cz>
Date: Wed, 11 Nov 2015 12:52:11 +0100
Subject: [PATCH] Fix big memory leak in ix86_valid_target_attribute_p

gcc/ChangeLog:

2015-11-12  Martin Liska  <mliska@suse.cz>

	* config/i386/i386.c (ix86_valid_target_attribute_p):
	Finalize options at the of the function.
	* gcc.c (driver_get_configure_time_options): Call newly
	introduced init_opts_obstack.
	* lto-wrapper.c (main): Likewise.
	* opts.c (init_opts_obstack): New function.
	(init_options_struct): Call newly
	introduced init_opts_obstack.
	* opts.h (init_options_struct): Declare.
---
 gcc/config/i386/i386.c |  2 ++
 gcc/gcc.c              |  2 +-
 gcc/lto-wrapper.c      |  2 +-
 gcc/opts.c             | 16 +++++++++++++++-
 gcc/opts.h             |  1 +
 5 files changed, 20 insertions(+), 3 deletions(-)

diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c
index b84a11d..1325cf0 100644
--- a/gcc/config/i386/i386.c
+++ b/gcc/config/i386/i386.c
@@ -6237,6 +6237,8 @@ ix86_valid_target_attribute_p (tree fndecl,
 	DECL_FUNCTION_SPECIFIC_OPTIMIZATION (fndecl) = new_optimize;
     }
 
+  finalize_options_struct (&func_options);
+
   return ret;
 }
 
diff --git a/gcc/gcc.c b/gcc/gcc.c
index 8bbf5be..87d1979 100644
--- a/gcc/gcc.c
+++ b/gcc/gcc.c
@@ -9915,7 +9915,7 @@ driver_get_configure_time_options (void (*cb) (const char *option,
   size_t i;
 
   obstack_init (&obstack);
-  gcc_obstack_init (&opts_obstack);
+  init_opts_obstack ();
   n_switches = 0;
 
   for (i = 0; i < ARRAY_SIZE (option_default_specs); i++)
diff --git a/gcc/lto-wrapper.c b/gcc/lto-wrapper.c
index 20e67ed..b9ac535 100644
--- a/gcc/lto-wrapper.c
+++ b/gcc/lto-wrapper.c
@@ -1355,7 +1355,7 @@ main (int argc, char *argv[])
 {
   const char *p;
 
-  gcc_obstack_init (&opts_obstack);
+  init_opts_obstack ();
 
   p = argv[0] + strlen (argv[0]);
   while (p != argv[0] && !IS_DIR_SEPARATOR (p[-1]))
diff --git a/gcc/opts.c b/gcc/opts.c
index 9a3fbb3..930ae43 100644
--- a/gcc/opts.c
+++ b/gcc/opts.c
@@ -266,6 +266,20 @@ add_comma_separated_to_vector (void **pvec, const char *arg)
   *pvec = v;
 }
 
+/* Initialize opts_obstack if not initialized.  */
+
+void
+init_opts_obstack (void)
+{
+  static bool opts_obstack_initialized = false;
+
+  if (!opts_obstack_initialized)
+    {
+      opts_obstack_initialized = true;
+      gcc_obstack_init (&opts_obstack);
+    }
+}
+
 /* Initialize OPTS and OPTS_SET before using them in parsing options.  */
 
 void
@@ -273,7 +287,7 @@ init_options_struct (struct gcc_options *opts, struct gcc_options *opts_set)
 {
   size_t num_params = get_num_compiler_params ();
 
-  gcc_obstack_init (&opts_obstack);
+  init_opts_obstack ();
 
   *opts = global_options_init;
 
diff --git a/gcc/opts.h b/gcc/opts.h
index 38b3837..2eb2d97 100644
--- a/gcc/opts.h
+++ b/gcc/opts.h
@@ -323,6 +323,7 @@ extern void decode_cmdline_options_to_array (unsigned int argc,
 extern void init_options_once (void);
 extern void init_options_struct (struct gcc_options *opts,
 				 struct gcc_options *opts_set);
+extern void init_opts_obstack (void);
 extern void finalize_options_struct (struct gcc_options *opts);
 extern void decode_cmdline_options_to_array_default_mask (unsigned int argc,
 							  const char **argv, 
-- 
2.6.2


[-- Attachment #3: 0001-Finalize-func_options-in-arm-target-in-arm_valid_tar.patch --]
[-- Type: text/x-patch, Size: 808 bytes --]

From b2a7dcae8de93db470da0b35162f5538337320ee Mon Sep 17 00:00:00 2001
From: marxin <mliska@suse.cz>
Date: Thu, 12 Nov 2015 16:41:16 +0100
Subject: [PATCH] Finalize func_options in arm target in
 arm_valid_target_attribute_p

gcc/ChangeLog:

2015-11-12  Martin Liska  <mliska@suse.cz>

	* config/arm/arm.c (arm_valid_target_attribute_p): Finalize
	options struct.
---
 gcc/config/arm/arm.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/gcc/config/arm/arm.c b/gcc/config/arm/arm.c
index f4ebbc8..941774b 100644
--- a/gcc/config/arm/arm.c
+++ b/gcc/config/arm/arm.c
@@ -29956,6 +29956,8 @@ arm_valid_target_attribute_p (tree fndecl, tree ARG_UNUSED (name),
 
   DECL_FUNCTION_SPECIFIC_OPTIMIZATION (fndecl) = new_optimize;
 
+  finalize_options_struct (&func_options);
+
   return ret;
 }
 
-- 
2.6.2


^ permalink raw reply	[flat|nested] 42+ messages in thread

* Re: [PATCH 04/N] Fix big memory leak in ix86_valid_target_attribute_p
  2015-11-12 15:52     ` Martin Liška
@ 2015-11-12 15:58       ` Ramana Radhakrishnan
  2015-11-12 16:24         ` Martin Liška
  0 siblings, 1 reply; 42+ messages in thread
From: Ramana Radhakrishnan @ 2015-11-12 15:58 UTC (permalink / raw)
  To: Martin Liška, Richard Biener; +Cc: GCC Patches, Jakub Jelinek



On 12/11/15 15:52, Martin Liška wrote:
> On 11/12/2015 12:29 PM, Richard Biener wrote:
>> On Thu, Nov 12, 2015 at 11:03 AM, Martin Liška <mliska@suse.cz> wrote:
>>> Hello.
>>>
>>> Following patch was a bit negotiated with Jakub and can save a huge amount of memory in cases
>>> where target attributes are heavily utilized.
>>>
>>> Can bootstrap and survives regression tests on x86_64-linux-pc.
>>>
>>> Ready for trunk?
>>
>> +static bool opts_obstack_initialized = false;
>> +
>> +/* Initialize opts_obstack if not initialized.  */
>> +
>> +void
>> +init_opts_obstack (void)
>> +{
>> +  if (!opts_obstack_initialized)
>> +    {
>> +      opts_obstack_initialized = true;
>> +      gcc_obstack_init (&opts_obstack);
>>
>> you can move the static global to function scope.
>>
>> Ok with that change.
> 
> Done and installed as r230264. Final version of the patch is attached.
> 
>>
>> Btw, don't other targets need a similar adjustment to their hook?
>> Grepping shows arm and nios2.
> 
> nios2 is not the case as it doesn't utilize:
>   init_options_struct (&func_options, NULL);
> 
> I've been testing patch for aarch64 that is also included in the email.

The change is also needed in config/aarch64/aarch64.c (aarch64_option_valid_attribute_p). The attached patch is for arm i.e. 32 bit arm.

Ramana

> 
> Martin
> 
>>
>> Thanks,
>> Richard.
>>
>>
>>> Thanks,
>>> Martin
> 

^ permalink raw reply	[flat|nested] 42+ messages in thread

* Re: [PATCH 04/N] Fix big memory leak in ix86_valid_target_attribute_p
  2015-11-12 15:58       ` Ramana Radhakrishnan
@ 2015-11-12 16:24         ` Martin Liška
  0 siblings, 0 replies; 42+ messages in thread
From: Martin Liška @ 2015-11-12 16:24 UTC (permalink / raw)
  To: Ramana Radhakrishnan, Richard Biener; +Cc: GCC Patches, Jakub Jelinek

On 11/12/2015 04:58 PM, Ramana Radhakrishnan wrote:
> 
> 
> On 12/11/15 15:52, Martin Liška wrote:
>> On 11/12/2015 12:29 PM, Richard Biener wrote:
>>> On Thu, Nov 12, 2015 at 11:03 AM, Martin Liška <mliska@suse.cz> wrote:
>>>> Hello.
>>>>
>>>> Following patch was a bit negotiated with Jakub and can save a huge amount of memory in cases
>>>> where target attributes are heavily utilized.
>>>>
>>>> Can bootstrap and survives regression tests on x86_64-linux-pc.
>>>>
>>>> Ready for trunk?
>>>
>>> +static bool opts_obstack_initialized = false;
>>> +
>>> +/* Initialize opts_obstack if not initialized.  */
>>> +
>>> +void
>>> +init_opts_obstack (void)
>>> +{
>>> +  if (!opts_obstack_initialized)
>>> +    {
>>> +      opts_obstack_initialized = true;
>>> +      gcc_obstack_init (&opts_obstack);
>>>
>>> you can move the static global to function scope.
>>>
>>> Ok with that change.
>>
>> Done and installed as r230264. Final version of the patch is attached.
>>
>>>
>>> Btw, don't other targets need a similar adjustment to their hook?
>>> Grepping shows arm and nios2.
>>
>> nios2 is not the case as it doesn't utilize:
>>   init_options_struct (&func_options, NULL);
>>
>> I've been testing patch for aarch64 that is also included in the email.
> 
> The change is also needed in config/aarch64/aarch64.c (aarch64_option_valid_attribute_p). The attached patch is for arm i.e. 32 bit arm.
> 
> Ramana

You are right that the change is for arm32, I wrongly wrote aarch64. However if you read
aarch64_option_valid_attribute_p, there is no init_options_struct (&func_options, NULL).

So that, I'm going to test on an arm32 machine.

Martin

> 
>>
>> Martin
>>
>>>
>>> Thanks,
>>> Richard.
>>>
>>>
>>>> Thanks,
>>>> Martin
>>

^ permalink raw reply	[flat|nested] 42+ messages in thread

* [PATCH 05/N] Fix memory leaks in graphite
  2015-11-09 11:22 [PATCH] Fix memory leaks and use a pool_allocator Martin Liška
                   ` (3 preceding siblings ...)
  2015-11-12 10:03 ` [PATCH 04/N] Fix big memory leak in ix86_valid_target_attribute_p Martin Liška
@ 2015-11-13 11:43 ` Martin Liška
  2015-11-13 12:16   ` Richard Biener
  2015-11-13 12:51 ` [PATCH] Fix memory leaks in tree-ssa-uninit.c Martin Liška
  2015-11-13 14:05 ` [PATCH 07/N] Fix memory leaks in haifa-sched Martin Liška
  6 siblings, 1 reply; 42+ messages in thread
From: Martin Liška @ 2015-11-13 11:43 UTC (permalink / raw)
  To: gcc-patches

[-- Attachment #1: Type: text/plain, Size: 90 bytes --]

Hello.

Patch survives regbootstrap on x86_64-linux-gnu.
Ready for trunk?

Thanks,
Martin

[-- Attachment #2: 0001-Fix-memory-leaks-in-graphite.patch --]
[-- Type: text/x-patch, Size: 2094 bytes --]

From 3f84b19e0ea7eacf26a566d3ef796397dafe76ce Mon Sep 17 00:00:00 2001
From: marxin <mliska@suse.cz>
Date: Thu, 12 Nov 2015 15:45:38 +0100
Subject: [PATCH] Fix memory leaks in graphite

---
 gcc/graphite-poly.c           |  1 +
 gcc/graphite-scop-detection.c | 27 ++++++++++++++++++---------
 2 files changed, 19 insertions(+), 9 deletions(-)

diff --git a/gcc/graphite-poly.c b/gcc/graphite-poly.c
index 5928b4c..809670a 100644
--- a/gcc/graphite-poly.c
+++ b/gcc/graphite-poly.c
@@ -328,6 +328,7 @@ free_scop (scop_p scop)
     free_poly_bb (pbb);
 
   scop->pbbs.release ();
+  scop->drs.release ();
 
   isl_set_free (scop->param_context);
   isl_union_map_free (scop->must_raw);
diff --git a/gcc/graphite-scop-detection.c b/gcc/graphite-scop-detection.c
index a7179d9..b5298d7 100644
--- a/gcc/graphite-scop-detection.c
+++ b/gcc/graphite-scop-detection.c
@@ -522,6 +522,11 @@ class scop_detection
 public:
   scop_detection () : scops (vNULL) {}
 
+  ~scop_detection ()
+  {
+    scops.release ();
+  }
+
   /* A marker for invalid sese_l.  */
   static sese_l invalid_sese;
 
@@ -1065,13 +1070,20 @@ scop_detection::harmful_stmt_in_region (sese_l scop) const
 
       /* The basic block should not be part of an irreducible loop.  */
       if (bb->flags & BB_IRREDUCIBLE_LOOP)
-        return true;
+	{
+	  dom.release ();
+	  return true;
+	}
 
       if (harmful_stmt_in_bb (scop, bb))
-	return true;
+	{
+	  dom.release ();
+	  return true;
+	}
     }
 
-    return false;
+  dom.release ();
+  return false;
 }
 
 /* Returns true if S1 subsumes/surrounds S2.  */
@@ -1749,12 +1761,9 @@ graphite_find_cross_bb_scalar_vars (scop_p scop, gimple *stmt,
 static gimple_poly_bb_p
 try_generate_gimple_bb (scop_p scop, basic_block bb)
 {
-  vec<data_reference_p> drs;
-  drs.create (3);
-  vec<tree> writes;
-  writes.create (3);
-  vec<scalar_use> reads;
-  reads.create (3);
+  vec<data_reference_p> drs = vNULL;
+  vec<tree> writes = vNULL;
+  vec<scalar_use> reads = vNULL;
 
   sese_l region = scop->scop_info->region;
   loop_p nest = outermost_loop_in_sese (region, bb);
-- 
2.6.2


^ permalink raw reply	[flat|nested] 42+ messages in thread

* Re: [PATCH 05/N] Fix memory leaks in graphite
  2015-11-13 11:43 ` [PATCH 05/N] Fix memory leaks in graphite Martin Liška
@ 2015-11-13 12:16   ` Richard Biener
  2015-11-13 23:48     ` Sebastian Pop
  0 siblings, 1 reply; 42+ messages in thread
From: Richard Biener @ 2015-11-13 12:16 UTC (permalink / raw)
  To: Martin Liška; +Cc: GCC Patches

On Fri, Nov 13, 2015 at 12:43 PM, Martin Liška <mliska@suse.cz> wrote:
> Hello.
>
> Patch survives regbootstrap on x86_64-linux-gnu.
> Ready for trunk?

Ok.

Richard.

> Thanks,
> Martin

^ permalink raw reply	[flat|nested] 42+ messages in thread

* Re: [PATCH] Fix memory leaks in tree-ssa-uninit.c
  2015-11-09 11:22 [PATCH] Fix memory leaks and use a pool_allocator Martin Liška
                   ` (4 preceding siblings ...)
  2015-11-13 11:43 ` [PATCH 05/N] Fix memory leaks in graphite Martin Liška
@ 2015-11-13 12:51 ` Martin Liška
  2015-11-13 16:32   ` Jeff Law
  2015-11-13 14:05 ` [PATCH 07/N] Fix memory leaks in haifa-sched Martin Liška
  6 siblings, 1 reply; 42+ messages in thread
From: Martin Liška @ 2015-11-13 12:51 UTC (permalink / raw)
  To: GCC Patches

[-- Attachment #1: Type: text/plain, Size: 90 bytes --]

Hello.

Patch survives regbootstrap on x86_64-linux-gnu.
Ready for trunk?

Thanks,
Martin

[-- Attachment #2: 0001-Fix-memory-leaks-in-tree-ssa-uninit.c.patch --]
[-- Type: text/x-patch, Size: 4184 bytes --]

From 54851503251dee7a8bd074485db262715e628728 Mon Sep 17 00:00:00 2001
From: marxin <mliska@suse.cz>
Date: Fri, 13 Nov 2015 12:23:22 +0100
Subject: [PATCH] Fix memory leaks in tree-ssa-uninit.c

gcc/ChangeLog:

2015-11-13  Martin Liska  <mliska@suse.cz>

	* tree-ssa-uninit.c (convert_control_dep_chain_into_preds):
	Fix GNU coding style.
	(find_def_preds): Use auto_vec.
	(destroy_predicate_vecs): Change signature of the function.
	(prune_uninit_phi_opnds_in_unrealizable_paths): Use the
	new signature.
	(simplify_preds_4): Use destroy_predicate_vecs instread of
	just releasing preds vector.
	(normalize_preds): Likewise.
	(is_use_properly_guarded): Use new signature of
	destroy_predicate_vecs.
	(find_uninit_use): Likewise.
---
 gcc/tree-ssa-uninit.c | 33 +++++++++++++++++----------------
 1 file changed, 17 insertions(+), 16 deletions(-)

diff --git a/gcc/tree-ssa-uninit.c b/gcc/tree-ssa-uninit.c
index a439363..0709cce 100644
--- a/gcc/tree-ssa-uninit.c
+++ b/gcc/tree-ssa-uninit.c
@@ -628,9 +628,9 @@ convert_control_dep_chain_into_preds (vec<edge> *dep_chains,
         }
 
       if (!has_valid_pred)
-        break;
+	break;
       else
-        preds->safe_push (t_chain);
+	preds->safe_push (t_chain);
     }
   return has_valid_pred;
 }
@@ -682,7 +682,7 @@ find_predicates (pred_chain_union *preds,
 
 static void
 collect_phi_def_edges (gphi *phi, basic_block cd_root,
-                       vec<edge> *edges,
+		       auto_vec<edge> *edges,
 		       hash_set<gimple *> *visited_phis)
 {
   size_t i, n;
@@ -739,7 +739,7 @@ find_def_preds (pred_chain_union *preds, gphi *phi)
   size_t num_chains = 0, i, n;
   vec<edge> dep_chains[MAX_NUM_CHAINS];
   auto_vec<edge, MAX_CHAIN_LEN + 1> cur_chain;
-  vec<edge> def_edges = vNULL;
+  auto_vec<edge> def_edges;
   bool has_valid_pred = false;
   basic_block phi_bb, cd_root = 0;
 
@@ -829,14 +829,14 @@ dump_predicates (gimple *usestmt, pred_chain_union preds,
 /* Destroys the predicate set *PREDS.  */
 
 static void
-destroy_predicate_vecs (pred_chain_union preds)
+destroy_predicate_vecs (pred_chain_union *preds)
 {
   size_t i;
 
-  size_t n = preds.length ();
+  size_t n = preds->length ();
   for (i = 0; i < n; i++)
-    preds[i].release ();
-  preds.release ();
+    (*preds)[i].release ();
+  preds->release ();
 }
 
 
@@ -1103,7 +1103,7 @@ prune_uninit_phi_opnds_in_unrealizable_paths (gphi *phi,
 					    uninit_opnds2,
 					    &def_preds,
 					    visited_phis);
-	      destroy_predicate_vecs (def_preds);
+	      destroy_predicate_vecs (&def_preds);
 	      if (!ok)
 		return false;
             }
@@ -1769,7 +1769,8 @@ simplify_preds_4 (pred_chain_union *preds)
             continue;
           s_preds.safe_push ((*preds)[i]);
         }
-      preds->release ();
+
+      destroy_predicate_vecs (preds);
       (*preds) = s_preds;
       s_preds = vNULL;
     }
@@ -2148,7 +2149,7 @@ normalize_preds (pred_chain_union preds, gimple *use_or_def, bool is_use)
       dump_predicates (use_or_def, norm_preds, is_use ? "[USE]:\n" : "[DEF]:\n");
     }
 
-  preds.release ();
+  destroy_predicate_vecs (&preds);
   return norm_preds;
 }
 
@@ -2199,7 +2200,7 @@ is_use_properly_guarded (gimple *use_stmt,
 
   if (!has_valid_preds)
     {
-      destroy_predicate_vecs (preds);
+      destroy_predicate_vecs (&preds);
       return false;
     }
 
@@ -2210,7 +2211,7 @@ is_use_properly_guarded (gimple *use_stmt,
 
   if (is_properly_guarded)
     {
-      destroy_predicate_vecs (preds);
+      destroy_predicate_vecs (&preds);
       return true;
     }
 
@@ -2220,7 +2221,7 @@ is_use_properly_guarded (gimple *use_stmt,
 
       if (!has_valid_preds)
 	{
-	  destroy_predicate_vecs (preds);
+	  destroy_predicate_vecs (&preds);
 	  return false;
 	}
 
@@ -2233,7 +2234,7 @@ is_use_properly_guarded (gimple *use_stmt,
 
   is_properly_guarded = is_superset_of (*def_preds, preds);
 
-  destroy_predicate_vecs (preds);
+  destroy_predicate_vecs (&preds);
   return is_properly_guarded;
 }
 
@@ -2306,7 +2307,7 @@ find_uninit_use (gphi *phi, unsigned uninit_opnds,
         }
     }
 
-  destroy_predicate_vecs (def_preds);
+  destroy_predicate_vecs (&def_preds);
   return ret;
 }
 
-- 
2.6.2


^ permalink raw reply	[flat|nested] 42+ messages in thread

* [PATCH 07/N] Fix memory leaks in haifa-sched
  2015-11-09 11:22 [PATCH] Fix memory leaks and use a pool_allocator Martin Liška
                   ` (5 preceding siblings ...)
  2015-11-13 12:51 ` [PATCH] Fix memory leaks in tree-ssa-uninit.c Martin Liška
@ 2015-11-13 14:05 ` Martin Liška
  2015-11-13 16:08   ` Jeff Law
  6 siblings, 1 reply; 42+ messages in thread
From: Martin Liška @ 2015-11-13 14:05 UTC (permalink / raw)
  To: gcc-patches

[-- Attachment #1: Type: text/plain, Size: 114 bytes --]

Hello.

Patch can bootstrap on x86_64-linux-pc and regression tests are running.

Ready for trunk?
Thanks,
Martin

[-- Attachment #2: 0001-Release-memory-in-haifa-sched.patch --]
[-- Type: text/x-patch, Size: 1230 bytes --]

From 630eba9465d6502b49bac163f985d25aee982e03 Mon Sep 17 00:00:00 2001
From: marxin <mliska@suse.cz>
Date: Fri, 13 Nov 2015 10:37:21 +0100
Subject: [PATCH] Release memory in haifa-sched

gcc/ChangeLog:

2015-11-13  Martin Liska  <mliska@suse.cz>

	* haifa-sched.c (haifa_finish_h_i_d): Release reg_set_list.
---
 gcc/haifa-sched.c | 13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)

diff --git a/gcc/haifa-sched.c b/gcc/haifa-sched.c
index e712110..7443ac5 100644
--- a/gcc/haifa-sched.c
+++ b/gcc/haifa-sched.c
@@ -9147,17 +9147,24 @@ haifa_finish_h_i_d (void)
 {
   int i;
   haifa_insn_data_t data;
-  struct reg_use_data *use, *next;
+  reg_use_data *use, *next_use;
+  reg_set_data *set, *next_set;
 
   FOR_EACH_VEC_ELT (h_i_d, i, data)
     {
       free (data->max_reg_pressure);
       free (data->reg_pressure);
-      for (use = data->reg_use_list; use != NULL; use = next)
+      for (use = data->reg_use_list; use != NULL; use = next_use)
 	{
-	  next = use->next_insn_use;
+	  next_use = use->next_insn_use;
 	  free (use);
 	}
+      for (set = data->reg_set_list; set != NULL; set = next_set)
+	{
+	  next_set = set->next_insn_set;
+	  free (set);
+	}
+
     }
   h_i_d.release ();
 }
-- 
2.6.2


^ permalink raw reply	[flat|nested] 42+ messages in thread

* Re: [PATCH 07/N] Fix memory leaks in haifa-sched
  2015-11-13 14:05 ` [PATCH 07/N] Fix memory leaks in haifa-sched Martin Liška
@ 2015-11-13 16:08   ` Jeff Law
  0 siblings, 0 replies; 42+ messages in thread
From: Jeff Law @ 2015-11-13 16:08 UTC (permalink / raw)
  To: Martin Liška, gcc-patches

On 11/13/2015 07:05 AM, Martin Liška wrote:
> Hello.
>
> Patch can bootstrap on x86_64-linux-pc and regression tests are running.
>
> Ready for trunk?
> Thanks,
> Martin
>
>
> 0001-Release-memory-in-haifa-sched.patch
>
>
>  From 630eba9465d6502b49bac163f985d25aee982e03 Mon Sep 17 00:00:00 2001
> From: marxin<mliska@suse.cz>
> Date: Fri, 13 Nov 2015 10:37:21 +0100
> Subject: [PATCH] Release memory in haifa-sched
>
> gcc/ChangeLog:
>
> 2015-11-13  Martin Liska<mliska@suse.cz>
>
> 	* haifa-sched.c (haifa_finish_h_i_d): Release reg_set_list.
OK.  Thanks for taking care of this.

Jeff

^ permalink raw reply	[flat|nested] 42+ messages in thread

* Re: [PATCH] Fix memory leaks in tree-ssa-uninit.c
  2015-11-13 12:51 ` [PATCH] Fix memory leaks in tree-ssa-uninit.c Martin Liška
@ 2015-11-13 16:32   ` Jeff Law
  2015-11-13 16:58     ` Martin Liška
  0 siblings, 1 reply; 42+ messages in thread
From: Jeff Law @ 2015-11-13 16:32 UTC (permalink / raw)
  To: Martin Liška, GCC Patches

On 11/13/2015 05:50 AM, Martin Liška wrote:
> Hello.
>
> Patch survives regbootstrap on x86_64-linux-gnu.
> Ready for trunk?
>
> Thanks,
> Martin
>
>
> 0001-Fix-memory-leaks-in-tree-ssa-uninit.c.patch
>
>
>  From 54851503251dee7a8bd074485db262715e628728 Mon Sep 17 00:00:00 2001
> From: marxin<mliska@suse.cz>
> Date: Fri, 13 Nov 2015 12:23:22 +0100
> Subject: [PATCH] Fix memory leaks in tree-ssa-uninit.c
>
> gcc/ChangeLog:
>
> 2015-11-13  Martin Liska<mliska@suse.cz>
>
> 	* tree-ssa-uninit.c (convert_control_dep_chain_into_preds):
> 	Fix GNU coding style.
> 	(find_def_preds): Use auto_vec.
> 	(destroy_predicate_vecs): Change signature of the function.
> 	(prune_uninit_phi_opnds_in_unrealizable_paths): Use the
> 	new signature.
> 	(simplify_preds_4): Use destroy_predicate_vecs instread of
> 	just releasing preds vector.
> 	(normalize_preds): Likewise.
> 	(is_use_properly_guarded): Use new signature of
> 	destroy_predicate_vecs.
> 	(find_uninit_use): Likewise.
OK.

FWIW, there's all kinds of spaces vs tabs issues in this file.  I'm 
curious why you chose to fix convert_control_dep_chain_into_preds, but 
didn't change any others.

Jeff

^ permalink raw reply	[flat|nested] 42+ messages in thread

* Re: [PATCH] Fix memory leaks in tree-ssa-uninit.c
  2015-11-13 16:32   ` Jeff Law
@ 2015-11-13 16:58     ` Martin Liška
  2015-11-13 19:19       ` Jeff Law
  0 siblings, 1 reply; 42+ messages in thread
From: Martin Liška @ 2015-11-13 16:58 UTC (permalink / raw)
  To: gcc-patches

On 11/13/2015 05:32 PM, Jeff Law wrote:
> On 11/13/2015 05:50 AM, Martin Liška wrote:
>> Hello.
>>
>> Patch survives regbootstrap on x86_64-linux-gnu.
>> Ready for trunk?
>>
>> Thanks,
>> Martin
>>
>>
>> 0001-Fix-memory-leaks-in-tree-ssa-uninit.c.patch
>>
>>
>>  From 54851503251dee7a8bd074485db262715e628728 Mon Sep 17 00:00:00 2001
>> From: marxin<mliska@suse.cz>
>> Date: Fri, 13 Nov 2015 12:23:22 +0100
>> Subject: [PATCH] Fix memory leaks in tree-ssa-uninit.c
>>
>> gcc/ChangeLog:
>>
>> 2015-11-13  Martin Liska<mliska@suse.cz>
>>
>>     * tree-ssa-uninit.c (convert_control_dep_chain_into_preds):
>>     Fix GNU coding style.
>>     (find_def_preds): Use auto_vec.
>>     (destroy_predicate_vecs): Change signature of the function.
>>     (prune_uninit_phi_opnds_in_unrealizable_paths): Use the
>>     new signature.
>>     (simplify_preds_4): Use destroy_predicate_vecs instread of
>>     just releasing preds vector.
>>     (normalize_preds): Likewise.
>>     (is_use_properly_guarded): Use new signature of
>>     destroy_predicate_vecs.
>>     (find_uninit_use): Likewise.
> OK.
> 
> FWIW, there's all kinds of spaces vs tabs issues in this file.  I'm curious why you chose to fix convert_control_dep_chain_into_preds, but didn't change any others.

Hi Jeff.

Thanks for confirmation, you are right, it's full of coding style issues. I can change these if it would be desired?

Thanks,
Martin

> 
> Jeff

^ permalink raw reply	[flat|nested] 42+ messages in thread

* Re: [PATCH] Fix memory leaks in tree-ssa-uninit.c
  2015-11-13 16:58     ` Martin Liška
@ 2015-11-13 19:19       ` Jeff Law
  2015-11-18 14:23         ` Martin Liška
  0 siblings, 1 reply; 42+ messages in thread
From: Jeff Law @ 2015-11-13 19:19 UTC (permalink / raw)
  To: Martin Liška, gcc-patches

On 11/13/2015 09:58 AM, Martin Liška wrote:
> On 11/13/2015 05:32 PM, Jeff Law wrote:
>> On 11/13/2015 05:50 AM, Martin Liška wrote:
>>> Hello.
>>>
>>> Patch survives regbootstrap on x86_64-linux-gnu.
>>> Ready for trunk?
>>>
>>> Thanks,
>>> Martin
>>>
>>>
>>> 0001-Fix-memory-leaks-in-tree-ssa-uninit.c.patch
>>>
>>>
>>>   From 54851503251dee7a8bd074485db262715e628728 Mon Sep 17 00:00:00 2001
>>> From: marxin<mliska@suse.cz>
>>> Date: Fri, 13 Nov 2015 12:23:22 +0100
>>> Subject: [PATCH] Fix memory leaks in tree-ssa-uninit.c
>>>
>>> gcc/ChangeLog:
>>>
>>> 2015-11-13  Martin Liska<mliska@suse.cz>
>>>
>>>      * tree-ssa-uninit.c (convert_control_dep_chain_into_preds):
>>>      Fix GNU coding style.
>>>      (find_def_preds): Use auto_vec.
>>>      (destroy_predicate_vecs): Change signature of the function.
>>>      (prune_uninit_phi_opnds_in_unrealizable_paths): Use the
>>>      new signature.
>>>      (simplify_preds_4): Use destroy_predicate_vecs instread of
>>>      just releasing preds vector.
>>>      (normalize_preds): Likewise.
>>>      (is_use_properly_guarded): Use new signature of
>>>      destroy_predicate_vecs.
>>>      (find_uninit_use): Likewise.
>> OK.
>>
>> FWIW, there's all kinds of spaces vs tabs issues in this file.  I'm curious why you chose to fix convert_control_dep_chain_into_preds, but didn't change any others.
>
> Hi Jeff.
>
> Thanks for confirmation, you are right, it's full of coding style issues. I can change these if it would be desired?
It's probably a good thing to do.  Given it'd strictly be formatting, 
I'd even consider it post-stage1.

jeff

^ permalink raw reply	[flat|nested] 42+ messages in thread

* Re: [PATCH 05/N] Fix memory leaks in graphite
  2015-11-13 12:16   ` Richard Biener
@ 2015-11-13 23:48     ` Sebastian Pop
  0 siblings, 0 replies; 42+ messages in thread
From: Sebastian Pop @ 2015-11-13 23:48 UTC (permalink / raw)
  To: Richard Biener; +Cc: Martin Liška, GCC Patches

On Fri, Nov 13, 2015 at 6:15 AM, Richard Biener
<richard.guenther@gmail.com> wrote:
> On Fri, Nov 13, 2015 at 12:43 PM, Martin Liška <mliska@suse.cz> wrote:
>> Hello.
>>
>> Patch survives regbootstrap on x86_64-linux-gnu.
>> Ready for trunk?

Thanks Martin for the patch.

Sebastian

>
> Ok.
>
> Richard.
>
>> Thanks,
>> Martin

^ permalink raw reply	[flat|nested] 42+ messages in thread

* Re: [PATCH] Fix memory leaks in tree-ssa-uninit.c
  2015-11-13 19:19       ` Jeff Law
@ 2015-11-18 14:23         ` Martin Liška
  2015-11-18 16:59           ` Jeff Law
  2015-11-19  0:50           ` Joseph Myers
  0 siblings, 2 replies; 42+ messages in thread
From: Martin Liška @ 2015-11-18 14:23 UTC (permalink / raw)
  To: gcc-patches; +Cc: law

[-- Attachment #1: Type: text/plain, Size: 1999 bytes --]

On 11/13/2015 08:19 PM, Jeff Law wrote:
> On 11/13/2015 09:58 AM, Martin Liška wrote:
>> On 11/13/2015 05:32 PM, Jeff Law wrote:
>>> On 11/13/2015 05:50 AM, Martin Liška wrote:
>>>> Hello.
>>>>
>>>> Patch survives regbootstrap on x86_64-linux-gnu.
>>>> Ready for trunk?
>>>>
>>>> Thanks,
>>>> Martin
>>>>
>>>>
>>>> 0001-Fix-memory-leaks-in-tree-ssa-uninit.c.patch
>>>>
>>>>
>>>>   From 54851503251dee7a8bd074485db262715e628728 Mon Sep 17 00:00:00 2001
>>>> From: marxin<mliska@suse.cz>
>>>> Date: Fri, 13 Nov 2015 12:23:22 +0100
>>>> Subject: [PATCH] Fix memory leaks in tree-ssa-uninit.c
>>>>
>>>> gcc/ChangeLog:
>>>>
>>>> 2015-11-13  Martin Liska<mliska@suse.cz>
>>>>
>>>>      * tree-ssa-uninit.c (convert_control_dep_chain_into_preds):
>>>>      Fix GNU coding style.
>>>>      (find_def_preds): Use auto_vec.
>>>>      (destroy_predicate_vecs): Change signature of the function.
>>>>      (prune_uninit_phi_opnds_in_unrealizable_paths): Use the
>>>>      new signature.
>>>>      (simplify_preds_4): Use destroy_predicate_vecs instread of
>>>>      just releasing preds vector.
>>>>      (normalize_preds): Likewise.
>>>>      (is_use_properly_guarded): Use new signature of
>>>>      destroy_predicate_vecs.
>>>>      (find_uninit_use): Likewise.
>>> OK.
>>>
>>> FWIW, there's all kinds of spaces vs tabs issues in this file.  I'm curious why you chose to fix convert_control_dep_chain_into_preds, but didn't change any others.
>>
>> Hi Jeff.
>>
>> Thanks for confirmation, you are right, it's full of coding style issues. I can change these if it would be desired?
> It's probably a good thing to do.  Given it'd strictly be formatting, I'd even consider it post-stage1.
> 
> jeff

Hello.

I'm sending the re-formatted source file.

The source file was formatted by clang-format ([1]) and some hunk were manually re-formatted.
No change in behavior.

Patch can regbootstrap on x86_64-linux-gnu.

Ready for trunk?
Thanks,
Martin

[1] https://gcc.gnu.org/ml/gcc-patches/2015-11/msg02214.html

[-- Attachment #2: 0001-Reformat-tree-ssa-uninit.c.patch --]
[-- Type: text/x-patch, Size: 77814 bytes --]

From bef9e38d9c63868ee569b1c3da253b8baa523eb0 Mon Sep 17 00:00:00 2001
From: marxin <mliska@suse.cz>
Date: Wed, 18 Nov 2015 10:20:11 +0100
Subject: [PATCH 1/2] Reformat tree-ssa-uninit.c

---
 gcc/tree-ssa-uninit.c | 1391 ++++++++++++++++++++++++-------------------------
 1 file changed, 678 insertions(+), 713 deletions(-)

diff --git a/gcc/tree-ssa-uninit.c b/gcc/tree-ssa-uninit.c
index 0709cce..fcdb774 100644
--- a/gcc/tree-ssa-uninit.c
+++ b/gcc/tree-ssa-uninit.c
@@ -35,16 +35,15 @@ along with GCC; see the file COPYING3.  If not see
 #include "tree-cfg.h"
 
 /* This implements the pass that does predicate aware warning on uses of
-   possibly uninitialized variables. The pass first collects the set of
-   possibly uninitialized SSA names. For each such name, it walks through
-   all its immediate uses. For each immediate use, it rebuilds the condition
-   expression (the predicate) that guards the use. The predicate is then
+   possibly uninitialized variables.  The pass first collects the set of
+   possibly uninitialized SSA names.  For each such name, it walks through
+   all its immediate uses.  For each immediate use, it rebuilds the condition
+   expression (the predicate) that guards the use.  The predicate is then
    examined to see if the variable is always defined under that same condition.
    This is done either by pruning the unrealizable paths that lead to the
    default definitions or by checking if the predicate set that guards the
    defining paths is a superset of the use predicate.  */
 
-
 /* Pointer set of potentially undefined ssa names, i.e.,
    ssa names that are defined by phi with operands that
    are not defined or potentially undefined.  */
@@ -56,7 +55,7 @@ static hash_set<tree> *possibly_undefined_names = 0;
 #define MASK_EMPTY(mask) (mask == 0)
 
 /* Returns the first bit position (starting from LSB)
-   in mask that is non zero. Returns -1 if the mask is empty.  */
+   in mask that is non zero.  Returns -1 if the mask is empty.  */
 static int
 get_mask_first_set_bit (unsigned mask)
 {
@@ -75,18 +74,17 @@ get_mask_first_set_bit (unsigned mask)
 static bool
 has_undefined_value_p (tree t)
 {
-  return (ssa_undefined_value_p (t)
-          || (possibly_undefined_names
-              && possibly_undefined_names->contains (t)));
+  return ssa_undefined_value_p (t)
+	 || (possibly_undefined_names
+	     && possibly_undefined_names->contains (t));
 }
 
-
-
 /* Like has_undefined_value_p, but don't return true if TREE_NO_WARNING
    is set on SSA_NAME_VAR.  */
 
 static inline bool
-uninit_undefined_value_p (tree t) {
+uninit_undefined_value_p (tree t)
+{
   if (!has_undefined_value_p (t))
     return false;
   if (SSA_NAME_VAR (t) && TREE_NO_WARNING (SSA_NAME_VAR (t)))
@@ -112,13 +110,13 @@ uninit_undefined_value_p (tree t) {
 /* Emit a warning for EXPR based on variable VAR at the point in the
    program T, an SSA_NAME, is used being uninitialized.  The exact
    warning text is in MSGID and DATA is the gimple stmt with info about
-   the location in source code. When DATA is a GIMPLE_PHI, PHIARG_IDX
+   the location in source code.  When DATA is a GIMPLE_PHI, PHIARG_IDX
    gives which argument of the phi node to take the location from.  WC
    is the warning code.  */
 
 static void
-warn_uninit (enum opt_code wc, tree t, tree expr, tree var,
-	     const char *gmsgid, void *data, location_t phiarg_loc)
+warn_uninit (enum opt_code wc, tree t, tree expr, tree var, const char *gmsgid,
+	     void *data, location_t phiarg_loc)
 {
   gimple *context = (gimple *) data;
   location_t location, cfun_loc;
@@ -135,10 +133,9 @@ warn_uninit (enum opt_code wc, tree t, tree expr, tree var,
 
   /* TREE_NO_WARNING either means we already warned, or the front end
      wishes to suppress the warning.  */
-  if ((context
-       && (gimple_no_warning_p (context)
-	   || (gimple_assign_single_p (context)
-	       && TREE_NO_WARNING (gimple_assign_rhs1 (context)))))
+  if ((context && (gimple_no_warning_p (context)
+		   || (gimple_assign_single_p (context)
+		       && TREE_NO_WARNING (gimple_assign_rhs1 (context)))))
       || TREE_NO_WARNING (expr))
     return;
 
@@ -149,8 +146,7 @@ warn_uninit (enum opt_code wc, tree t, tree expr, tree var,
   else
     location = DECL_SOURCE_LOCATION (var);
   location = linemap_resolve_location (line_table, location,
-				       LRK_SPELLING_LOCATION,
-				       NULL);
+				       LRK_SPELLING_LOCATION, NULL);
   cfun_loc = DECL_SOURCE_LOCATION (cfun->decl);
   xloc = expand_location (location);
   floc = expand_location (cfun_loc);
@@ -161,10 +157,8 @@ warn_uninit (enum opt_code wc, tree t, tree expr, tree var,
       if (location == DECL_SOURCE_LOCATION (var))
 	return;
       if (xloc.file != floc.file
-	  || linemap_location_before_p (line_table,
-					location, cfun_loc)
-	  || linemap_location_before_p (line_table,
-					cfun->function_end_locus,
+	  || linemap_location_before_p (line_table, location, cfun_loc)
+	  || linemap_location_before_p (line_table, cfun->function_end_locus,
 					location))
 	inform (DECL_SOURCE_LOCATION (var), "%qD was declared here", var);
     }
@@ -178,8 +172,9 @@ warn_uninitialized_vars (bool warn_possibly_uninitialized)
 
   FOR_EACH_BB_FN (bb, cfun)
     {
-      bool always_executed = dominated_by_p (CDI_POST_DOMINATORS,
-					     single_succ (ENTRY_BLOCK_PTR_FOR_FN (cfun)), bb);
+      bool always_executed
+	= dominated_by_p (CDI_POST_DOMINATORS,
+			  single_succ (ENTRY_BLOCK_PTR_FOR_FN (cfun)), bb);
       for (gsi = gsi_start_bb (bb); !gsi_end_p (gsi); gsi_next (&gsi))
 	{
 	  gimple *stmt = gsi_stmt (gsi);
@@ -196,13 +191,13 @@ warn_uninitialized_vars (bool warn_possibly_uninitialized)
 	    {
 	      use = USE_FROM_PTR (use_p);
 	      if (always_executed)
-		warn_uninit (OPT_Wuninitialized, use,
-			     SSA_NAME_VAR (use), SSA_NAME_VAR (use),
-			     "%qD is used uninitialized in this function",
-			     stmt, UNKNOWN_LOCATION);
+		warn_uninit (OPT_Wuninitialized, use, SSA_NAME_VAR (use),
+			     SSA_NAME_VAR (use),
+			     "%qD is used uninitialized in this function", stmt,
+			     UNKNOWN_LOCATION);
 	      else if (warn_possibly_uninitialized)
-		warn_uninit (OPT_Wmaybe_uninitialized, use,
-			     SSA_NAME_VAR (use), SSA_NAME_VAR (use),
+		warn_uninit (OPT_Wmaybe_uninitialized, use, SSA_NAME_VAR (use),
+			     SSA_NAME_VAR (use),
 			     "%qD may be used uninitialized in this function",
 			     stmt, UNKNOWN_LOCATION);
 	    }
@@ -217,24 +212,20 @@ warn_uninitialized_vars (bool warn_possibly_uninitialized)
 	     so must be limited which means we would miss warning
 	     opportunities.  */
 	  use = gimple_vuse (stmt);
-	  if (use
-	      && gimple_assign_single_p (stmt)
-	      && !gimple_vdef (stmt)
+	  if (use && gimple_assign_single_p (stmt) && !gimple_vdef (stmt)
 	      && SSA_NAME_IS_DEFAULT_DEF (use))
 	    {
 	      tree rhs = gimple_assign_rhs1 (stmt);
 	      tree base = get_base_address (rhs);
 
 	      /* Do not warn if it can be initialized outside this function.  */
-	      if (TREE_CODE (base) != VAR_DECL
-		  || DECL_HARD_REGISTER (base)
+	      if (TREE_CODE (base) != VAR_DECL || DECL_HARD_REGISTER (base)
 		  || is_global_var (base))
 		continue;
 
 	      if (always_executed)
-		warn_uninit (OPT_Wuninitialized, use,
-			     gimple_assign_rhs1 (stmt), base,
-			     "%qE is used uninitialized in this function",
+		warn_uninit (OPT_Wuninitialized, use, gimple_assign_rhs1 (stmt),
+			     base, "%qE is used uninitialized in this function",
 			     stmt, UNKNOWN_LOCATION);
 	      else if (warn_possibly_uninitialized)
 		warn_uninit (OPT_Wmaybe_uninitialized, use,
@@ -250,9 +241,9 @@ warn_uninitialized_vars (bool warn_possibly_uninitialized)
 
 /* Checks if the operand OPND of PHI is defined by
    another phi with one operand defined by this PHI,
-   but the rest operands are all defined. If yes,
+   but the rest operands are all defined.  If yes,
    returns true to skip this operand as being
-   redundant. Can be enhanced to be more general.  */
+   redundant.  Can be enhanced to be more general.  */
 
 static bool
 can_skip_redundant_opnd (tree opnd, gimple *phi)
@@ -270,9 +261,9 @@ can_skip_redundant_opnd (tree opnd, gimple *phi)
     {
       tree op = gimple_phi_arg_def (op_def, i);
       if (TREE_CODE (op) != SSA_NAME)
-        continue;
+	continue;
       if (op != phi_def && uninit_undefined_value_p (op))
-        return false;
+	return false;
     }
 
   return true;
@@ -295,11 +286,10 @@ compute_uninit_opnds_pos (gphi *phi)
   for (i = 0; i < n; ++i)
     {
       tree op = gimple_phi_arg_def (phi, i);
-      if (TREE_CODE (op) == SSA_NAME
-          && uninit_undefined_value_p (op)
-          && !can_skip_redundant_opnd (op, phi))
+      if (TREE_CODE (op) == SSA_NAME && uninit_undefined_value_p (op)
+	  && !can_skip_redundant_opnd (op, phi))
 	{
-          if (cfun->has_nonlocal_label || cfun->calls_setjmp)
+	  if (cfun->has_nonlocal_label || cfun->calls_setjmp)
 	    {
 	      /* Ignore SSA_NAMEs that appear on abnormal edges
 		 somewhere.  */
@@ -318,37 +308,35 @@ compute_uninit_opnds_pos (gphi *phi)
 static inline basic_block
 find_pdom (basic_block block)
 {
-   if (block == EXIT_BLOCK_PTR_FOR_FN (cfun))
-     return EXIT_BLOCK_PTR_FOR_FN (cfun);
-   else
-     {
-       basic_block bb
-           = get_immediate_dominator (CDI_POST_DOMINATORS, block);
-       if (! bb)
-	 return EXIT_BLOCK_PTR_FOR_FN (cfun);
-       return bb;
-     }
+  if (block == EXIT_BLOCK_PTR_FOR_FN (cfun))
+    return EXIT_BLOCK_PTR_FOR_FN (cfun);
+  else
+    {
+      basic_block bb = get_immediate_dominator (CDI_POST_DOMINATORS, block);
+      if (!bb)
+	return EXIT_BLOCK_PTR_FOR_FN (cfun);
+      return bb;
+    }
 }
 
-/* Find the immediate DOM of the specified
-   basic block BLOCK.  */
+/* Find the immediate DOM of the specified basic block BLOCK.  */
 
 static inline basic_block
 find_dom (basic_block block)
 {
-   if (block == ENTRY_BLOCK_PTR_FOR_FN (cfun))
-     return ENTRY_BLOCK_PTR_FOR_FN (cfun);
-   else
-     {
-       basic_block bb = get_immediate_dominator (CDI_DOMINATORS, block);
-       if (! bb)
-	 return ENTRY_BLOCK_PTR_FOR_FN (cfun);
-       return bb;
-     }
+  if (block == ENTRY_BLOCK_PTR_FOR_FN (cfun))
+    return ENTRY_BLOCK_PTR_FOR_FN (cfun);
+  else
+    {
+      basic_block bb = get_immediate_dominator (CDI_DOMINATORS, block);
+      if (!bb)
+	return ENTRY_BLOCK_PTR_FOR_FN (cfun);
+      return bb;
+    }
 }
 
 /* Returns true if BB1 is postdominating BB2 and BB1 is
-   not a loop exit bb. The loop exit bb check is simple and does
+   not a loop exit bb.  The loop exit bb check is simple and does
    not cover all cases.  */
 
 static bool
@@ -366,7 +354,7 @@ is_non_loop_exit_postdominating (basic_block bb1, basic_block bb2)
 /* Find the closest postdominator of a specified BB, which is control
    equivalent to BB.  */
 
-static inline  basic_block
+static inline basic_block
 find_control_equiv_block (basic_block bb)
 {
   basic_block pdom;
@@ -398,10 +386,8 @@ find_control_equiv_block (basic_block bb)
 
 static bool
 compute_control_dep_chain (basic_block bb, basic_block dep_bb,
-                           vec<edge> *cd_chains,
-                           size_t *num_chains,
-			   vec<edge> *cur_cd_chain,
-			   int *num_calls)
+			   vec<edge> *cd_chains, size_t *num_chains,
+			   vec<edge> *cur_cd_chain, int *num_calls)
 {
   edge_iterator ei;
   edge e;
@@ -424,9 +410,9 @@ compute_control_dep_chain (basic_block bb, basic_block dep_bb,
   for (i = 0; i < cur_chain_len; i++)
     {
       edge e = (*cur_cd_chain)[i];
-      /* Cycle detected. */
+      /* Cycle detected.  */
       if (e->src == bb)
-        return false;
+	return false;
     }
 
   FOR_EACH_EDGE (e, ei, bb->succs)
@@ -434,39 +420,39 @@ compute_control_dep_chain (basic_block bb, basic_block dep_bb,
       basic_block cd_bb;
       int post_dom_check = 0;
       if (e->flags & (EDGE_FAKE | EDGE_ABNORMAL))
-        continue;
+	continue;
 
       cd_bb = e->dest;
       cur_cd_chain->safe_push (e);
       while (!is_non_loop_exit_postdominating (cd_bb, bb))
-        {
-          if (cd_bb == dep_bb)
-            {
-              /* Found a direct control dependence.  */
-              if (*num_chains < MAX_NUM_CHAINS)
-                {
-                  cd_chains[*num_chains] = cur_cd_chain->copy ();
-                  (*num_chains)++;
-                }
-              found_cd_chain = true;
-              /* Check path from next edge.  */
-              break;
-            }
-
-          /* Now check if DEP_BB is indirectly control dependent on BB.  */
-          if (compute_control_dep_chain (cd_bb, dep_bb, cd_chains,
-					 num_chains, cur_cd_chain, num_calls))
-            {
-              found_cd_chain = true;
-              break;
-            }
-
-          cd_bb = find_pdom (cd_bb);
-          post_dom_check++;
-	  if (cd_bb == EXIT_BLOCK_PTR_FOR_FN (cfun) || post_dom_check >
-	      MAX_POSTDOM_CHECK)
-            break;
-        }
+	{
+	  if (cd_bb == dep_bb)
+	    {
+	      /* Found a direct control dependence.  */
+	      if (*num_chains < MAX_NUM_CHAINS)
+		{
+		  cd_chains[*num_chains] = cur_cd_chain->copy ();
+		  (*num_chains)++;
+		}
+	      found_cd_chain = true;
+	      /* Check path from next edge.  */
+	      break;
+	    }
+
+	  /* Now check if DEP_BB is indirectly control dependent on BB.  */
+	  if (compute_control_dep_chain (cd_bb, dep_bb, cd_chains, num_chains,
+					 cur_cd_chain, num_calls))
+	    {
+	      found_cd_chain = true;
+	      break;
+	    }
+
+	  cd_bb = find_pdom (cd_bb);
+	  post_dom_check++;
+	  if (cd_bb == EXIT_BLOCK_PTR_FOR_FN (cfun)
+	      || post_dom_check > MAX_POSTDOM_CHECK)
+	    break;
+	}
       cur_cd_chain->pop ();
       gcc_assert (cur_cd_chain->length () == cur_chain_len);
     }
@@ -475,7 +461,7 @@ compute_control_dep_chain (basic_block bb, basic_block dep_bb,
   return found_cd_chain;
 }
 
-/* The type to represent a simple predicate  */
+/* The type to represent a simple predicate.  */
 
 struct pred_info
 {
@@ -496,20 +482,19 @@ typedef vec<pred_info, va_heap, vl_ptr> pred_chain;
 typedef vec<pred_chain, va_heap, vl_ptr> pred_chain_union;
 
 /* Converts the chains of control dependence edges into a set of
-   predicates. A control dependence chain is represented by a vector
-   edges. DEP_CHAINS points to an array of dependence chains.
-   NUM_CHAINS is the size of the chain array. One edge in a dependence
+   predicates.  A control dependence chain is represented by a vector
+   edges.  DEP_CHAINS points to an array of dependence chains.
+   NUM_CHAINS is the size of the chain array.  One edge in a dependence
    chain is mapped to predicate expression represented by pred_info
-   type. One dependence chain is converted to a composite predicate that
+   type.  One dependence chain is converted to a composite predicate that
    is the result of AND operation of pred_info mapped to each edge.
-   A composite predicate is presented by a vector of pred_info. On
+   A composite predicate is presented by a vector of pred_info.  On
    return, *PREDS points to the resulting array of composite predicates.
    *NUM_PREDS is the number of composite predictes.  */
 
 static bool
-convert_control_dep_chain_into_preds (vec<edge> *dep_chains,
-                                      size_t num_chains,
-                                      pred_chain_union *preds)
+convert_control_dep_chain_into_preds (vec<edge> *dep_chains, size_t num_chains,
+				      pred_chain_union *preds)
 {
   bool has_valid_pred = false;
   size_t i, j;
@@ -527,48 +512,47 @@ convert_control_dep_chain_into_preds (vec<edge> *dep_chains,
       has_valid_pred = false;
       pred_chain t_chain = vNULL;
       for (j = 0; j < one_cd_chain.length (); j++)
-        {
+	{
 	  gimple *cond_stmt;
-          gimple_stmt_iterator gsi;
-          basic_block guard_bb;
-          pred_info one_pred;
-          edge e;
-
-          e = one_cd_chain[j];
-          guard_bb = e->src;
-          gsi = gsi_last_bb (guard_bb);
-          if (gsi_end_p (gsi))
-            {
-              has_valid_pred = false;
-              break;
-            }
-          cond_stmt = gsi_stmt (gsi);
-          if (is_gimple_call (cond_stmt)
-              && EDGE_COUNT (e->src->succs) >= 2)
-            {
-              /* Ignore EH edge. Can add assertion
-                 on the other edge's flag.  */
-              continue;
-            }
-          /* Skip if there is essentially one succesor.  */
-          if (EDGE_COUNT (e->src->succs) == 2)
-            {
-              edge e1;
-              edge_iterator ei1;
-              bool skip = false;
-
-              FOR_EACH_EDGE (e1, ei1, e->src->succs)
-                {
-                  if (EDGE_COUNT (e1->dest->succs) == 0)
-                    {
-                      skip = true;
-                      break;
-                    }
-                }
-              if (skip)
-                continue;
-            }
-          if (gimple_code (cond_stmt) == GIMPLE_COND)
+	  gimple_stmt_iterator gsi;
+	  basic_block guard_bb;
+	  pred_info one_pred;
+	  edge e;
+
+	  e = one_cd_chain[j];
+	  guard_bb = e->src;
+	  gsi = gsi_last_bb (guard_bb);
+	  if (gsi_end_p (gsi))
+	    {
+	      has_valid_pred = false;
+	      break;
+	    }
+	  cond_stmt = gsi_stmt (gsi);
+	  if (is_gimple_call (cond_stmt) && EDGE_COUNT (e->src->succs) >= 2)
+	    {
+	      /* Ignore EH edge.  Can add assertion
+		 on the other edge's flag.  */
+	      continue;
+	    }
+	  /* Skip if there is essentially one succesor.  */
+	  if (EDGE_COUNT (e->src->succs) == 2)
+	    {
+	      edge e1;
+	      edge_iterator ei1;
+	      bool skip = false;
+
+	      FOR_EACH_EDGE (e1, ei1, e->src->succs)
+		{
+		  if (EDGE_COUNT (e1->dest->succs) == 0)
+		    {
+		      skip = true;
+		      break;
+		    }
+		}
+	      if (skip)
+		continue;
+	    }
+	  if (gimple_code (cond_stmt) == GIMPLE_COND)
 	    {
 	      one_pred.pred_lhs = gimple_cond_lhs (cond_stmt);
 	      one_pred.pred_rhs = gimple_cond_rhs (cond_stmt);
@@ -577,7 +561,7 @@ convert_control_dep_chain_into_preds (vec<edge> *dep_chains,
 	      t_chain.safe_push (one_pred);
 	      has_valid_pred = true;
 	    }
-	  else if (gswitch *gs = dyn_cast <gswitch *> (cond_stmt))
+	  else if (gswitch *gs = dyn_cast<gswitch *> (cond_stmt))
 	    {
 	      /* Avoid quadratic behavior.  */
 	      if (gimple_switch_num_labels (gs) > MAX_SWITCH_CASES)
@@ -603,12 +587,11 @@ convert_control_dep_chain_into_preds (vec<edge> *dep_chains,
 		    }
 		}
 	      /* If more than one label reaches this block or the case
-	         label doesn't have a single value (like the default one)
+		 label doesn't have a single value (like the default one)
 		 fail.  */
-	      if (!l
-		  || !CASE_LOW (l)
-		  || (CASE_HIGH (l) && !operand_equal_p (CASE_LOW (l),
-							 CASE_HIGH (l), 0)))
+	      if (!l || !CASE_LOW (l)
+		  || (CASE_HIGH (l)
+		      && !operand_equal_p (CASE_LOW (l), CASE_HIGH (l), 0)))
 		{
 		  has_valid_pred = false;
 		  break;
@@ -621,11 +604,11 @@ convert_control_dep_chain_into_preds (vec<edge> *dep_chains,
 	      has_valid_pred = true;
 	    }
 	  else
-            {
-              has_valid_pred = false;
-              break;
-            }
-        }
+	    {
+	      has_valid_pred = false;
+	      break;
+	    }
+	}
 
       if (!has_valid_pred)
 	break;
@@ -635,15 +618,14 @@ convert_control_dep_chain_into_preds (vec<edge> *dep_chains,
   return has_valid_pred;
 }
 
-/* Computes all control dependence chains for USE_BB. The control
+/* Computes all control dependence chains for USE_BB.  The control
    dependence chains are then converted to an array of composite
    predicates pointed to by PREDS.  PHI_BB is the basic block of
    the phi whose result is used in USE_BB.  */
 
 static bool
-find_predicates (pred_chain_union *preds,
-                 basic_block phi_bb,
-                 basic_block use_bb)
+find_predicates (pred_chain_union *preds, basic_block phi_bb,
+		 basic_block use_bb)
 {
   size_t num_chains = 0, i;
   int num_calls = 0;
@@ -659,9 +641,9 @@ find_predicates (pred_chain_union *preds,
     {
       basic_block ctrl_eq_bb = find_control_equiv_block (cd_root);
       if (ctrl_eq_bb && dominated_by_p (CDI_DOMINATORS, use_bb, ctrl_eq_bb))
-        cd_root = ctrl_eq_bb;
+	cd_root = ctrl_eq_bb;
       else
-        break;
+	break;
     }
 
   compute_control_dep_chain (cd_root, use_bb, dep_chains, &num_chains,
@@ -676,13 +658,12 @@ find_predicates (pred_chain_union *preds,
 
 /* Computes the set of incoming edges of PHI that have non empty
    definitions of a phi chain.  The collection will be done
-   recursively on operands that are defined by phis. CD_ROOT
-   is the control dependence root. *EDGES holds the result, and
+   recursively on operands that are defined by phis.  CD_ROOT
+   is the control dependence root.  *EDGES holds the result, and
    VISITED_PHIS is a pointer set for detecting cycles.  */
 
 static void
-collect_phi_def_edges (gphi *phi, basic_block cd_root,
-		       auto_vec<edge> *edges,
+collect_phi_def_edges (gphi *phi, basic_block cd_root, auto_vec<edge> *edges,
 		       hash_set<gimple *> *visited_phis)
 {
   size_t i, n;
@@ -699,33 +680,33 @@ collect_phi_def_edges (gphi *phi, basic_block cd_root,
       opnd = gimple_phi_arg_def (phi, i);
 
       if (TREE_CODE (opnd) != SSA_NAME)
-        {
-          if (dump_file && (dump_flags & TDF_DETAILS))
-            {
-              fprintf (dump_file, "\n[CHECK] Found def edge %d in ", (int)i);
-              print_gimple_stmt (dump_file, phi, 0, 0);
-            }
-          edges->safe_push (opnd_edge);
-        }
+	{
+	  if (dump_file && (dump_flags & TDF_DETAILS))
+	    {
+	      fprintf (dump_file, "\n[CHECK] Found def edge %d in ", (int) i);
+	      print_gimple_stmt (dump_file, phi, 0, 0);
+	    }
+	  edges->safe_push (opnd_edge);
+	}
       else
-        {
+	{
 	  gimple *def = SSA_NAME_DEF_STMT (opnd);
 
-          if (gimple_code (def) == GIMPLE_PHI
-              && dominated_by_p (CDI_DOMINATORS,
-                                 gimple_bb (def), cd_root))
-            collect_phi_def_edges (as_a <gphi *> (def), cd_root, edges,
-                                   visited_phis);
-          else if (!uninit_undefined_value_p (opnd))
-            {
-              if (dump_file && (dump_flags & TDF_DETAILS))
-                {
-                  fprintf (dump_file, "\n[CHECK] Found def edge %d in ", (int)i);
-                  print_gimple_stmt (dump_file, phi, 0, 0);
-                }
-              edges->safe_push (opnd_edge);
-            }
-        }
+	  if (gimple_code (def) == GIMPLE_PHI
+	      && dominated_by_p (CDI_DOMINATORS, gimple_bb (def), cd_root))
+	    collect_phi_def_edges (as_a<gphi *> (def), cd_root, edges,
+				   visited_phis);
+	  else if (!uninit_undefined_value_p (opnd))
+	    {
+	      if (dump_file && (dump_flags & TDF_DETAILS))
+		{
+		  fprintf (dump_file, "\n[CHECK] Found def edge %d in ",
+			   (int) i);
+		  print_gimple_stmt (dump_file, phi, 0, 0);
+		}
+	      edges->safe_push (opnd_edge);
+	    }
+	}
     }
 }
 
@@ -745,7 +726,7 @@ find_def_preds (pred_chain_union *preds, gphi *phi)
 
   phi_bb = gimple_bb (phi);
   /* First find the closest dominating bb to be
-     the control dependence root  */
+     the control dependence root.  */
   cd_root = find_dom (phi_bb);
   if (!cd_root)
     return false;
@@ -769,14 +750,14 @@ find_def_preds (pred_chain_union *preds, gphi *phi)
 				 &num_chains, &cur_chain, &num_calls);
 
       /* Now update the newly added chains with
-         the phi operand edge:  */
+	 the phi operand edge:  */
       if (EDGE_COUNT (opnd_edge->src->succs) > 1)
-        {
+	{
 	  if (prev_nc == num_chains && num_chains < MAX_NUM_CHAINS)
 	    dep_chains[num_chains++] = vNULL;
-          for (j = prev_nc; j < num_chains; j++)
+	  for (j = prev_nc; j < num_chains; j++)
 	    dep_chains[j].safe_push (opnd_edge);
-        }
+	}
     }
 
   has_valid_pred
@@ -789,8 +770,7 @@ find_def_preds (pred_chain_union *preds, gphi *phi)
 /* Dumps the predicates (PREDS) for USESTMT.  */
 
 static void
-dump_predicates (gimple *usestmt, pred_chain_union preds,
-                 const char* msg)
+dump_predicates (gimple *usestmt, pred_chain_union preds, const char *msg)
 {
   size_t i, j;
   pred_chain one_pred_chain = vNULL;
@@ -807,22 +787,22 @@ dump_predicates (gimple *usestmt, pred_chain_union preds,
       np = one_pred_chain.length ();
 
       for (j = 0; j < np; j++)
-        {
-          pred_info one_pred = one_pred_chain[j];
-          if (one_pred.invert)
-            fprintf (dump_file, " (.NOT.) ");
-          print_generic_expr (dump_file, one_pred.pred_lhs, 0);
-          fprintf (dump_file, " %s ", op_symbol_code (one_pred.cond_code));
-          print_generic_expr (dump_file, one_pred.pred_rhs, 0);
-          if (j < np - 1)
-            fprintf (dump_file, " (.AND.) ");
-          else
-            fprintf (dump_file, "\n");
-        }
+	{
+	  pred_info one_pred = one_pred_chain[j];
+	  if (one_pred.invert)
+	    fprintf (dump_file, " (.NOT.) ");
+	  print_generic_expr (dump_file, one_pred.pred_lhs, 0);
+	  fprintf (dump_file, " %s ", op_symbol_code (one_pred.cond_code));
+	  print_generic_expr (dump_file, one_pred.pred_rhs, 0);
+	  if (j < np - 1)
+	    fprintf (dump_file, " (.AND.) ");
+	  else
+	    fprintf (dump_file, "\n");
+	}
       if (i < num_preds - 1)
-        fprintf (dump_file, "(.OR.)\n");
+	fprintf (dump_file, "(.OR.)\n");
       else
-        fprintf (dump_file, "\n\n");
+	fprintf (dump_file, "\n\n");
     }
 }
 
@@ -839,13 +819,11 @@ destroy_predicate_vecs (pred_chain_union *preds)
   preds->release ();
 }
 
-
 /* Computes the 'normalized' conditional code with operand
    swapping and condition inversion.  */
 
 static enum tree_code
-get_cmp_code (enum tree_code orig_cmp_code,
-              bool swap_cond, bool invert)
+get_cmp_code (enum tree_code orig_cmp_code, bool swap_cond, bool invert)
 {
   enum tree_code tc = orig_cmp_code;
 
@@ -880,14 +858,12 @@ is_value_included_in (tree val, tree boundary, enum tree_code cmpc)
   bool result;
 
   /* Only handle integer constant here.  */
-  if (TREE_CODE (val) != INTEGER_CST
-      || TREE_CODE (boundary) != INTEGER_CST)
+  if (TREE_CODE (val) != INTEGER_CST || TREE_CODE (boundary) != INTEGER_CST)
     return true;
 
   is_unsigned = TYPE_UNSIGNED (TREE_TYPE (val));
 
-  if (cmpc == GE_EXPR || cmpc == GT_EXPR
-      || cmpc == NE_EXPR)
+  if (cmpc == GE_EXPR || cmpc == GT_EXPR || cmpc == NE_EXPR)
     {
       cmpc = invert_tree_comparison (cmpc, false);
       inverted = true;
@@ -896,27 +872,27 @@ is_value_included_in (tree val, tree boundary, enum tree_code cmpc)
   if (is_unsigned)
     {
       if (cmpc == EQ_EXPR)
-        result = tree_int_cst_equal (val, boundary);
+	result = tree_int_cst_equal (val, boundary);
       else if (cmpc == LT_EXPR)
-        result = tree_int_cst_lt (val, boundary);
+	result = tree_int_cst_lt (val, boundary);
       else
-        {
-          gcc_assert (cmpc == LE_EXPR);
-          result = tree_int_cst_le (val, boundary);
-        }
+	{
+	  gcc_assert (cmpc == LE_EXPR);
+	  result = tree_int_cst_le (val, boundary);
+	}
     }
   else
     {
       if (cmpc == EQ_EXPR)
-        result = tree_int_cst_equal (val, boundary);
+	result = tree_int_cst_equal (val, boundary);
       else if (cmpc == LT_EXPR)
-        result = tree_int_cst_lt (val, boundary);
+	result = tree_int_cst_lt (val, boundary);
       else
-        {
-          gcc_assert (cmpc == LE_EXPR);
-          result = (tree_int_cst_equal (val, boundary)
-                    || tree_int_cst_lt (val, boundary));
-        }
+	{
+	  gcc_assert (cmpc == LE_EXPR);
+	  result = (tree_int_cst_equal (val, boundary)
+		    || tree_int_cst_lt (val, boundary));
+	}
     }
 
   if (inverted)
@@ -930,9 +906,8 @@ is_value_included_in (tree val, tree boundary, enum tree_code cmpc)
    NUM_PRED_CHAIN is the size of array PREDS.  */
 
 static bool
-find_matching_predicate_in_rest_chains (pred_info pred,
-                                        pred_chain_union preds,
-                                        size_t num_pred_chains)
+find_matching_predicate_in_rest_chains (pred_info pred, pred_chain_union preds,
+					size_t num_pred_chains)
 {
   size_t i, j, n;
 
@@ -946,39 +921,36 @@ find_matching_predicate_in_rest_chains (pred_info pred,
       pred_chain one_chain = preds[i];
       n = one_chain.length ();
       for (j = 0; j < n; j++)
-        {
-          pred_info pred2 = one_chain[j];
-          /* Can relax the condition comparison to not
-             use address comparison. However, the most common
-             case is that multiple control dependent paths share
-             a common path prefix, so address comparison should
-             be ok.  */
-
-          if (operand_equal_p (pred2.pred_lhs, pred.pred_lhs, 0)
-              && operand_equal_p (pred2.pred_rhs, pred.pred_rhs, 0)
-              && pred2.invert == pred.invert)
-            {
-              found = true;
-              break;
-            }
-        }
+	{
+	  pred_info pred2 = one_chain[j];
+	  /* Can relax the condition comparison to not
+	     use address comparison.  However, the most common
+	     case is that multiple control dependent paths share
+	     a common path prefix, so address comparison should
+	     be ok.  */
+
+	  if (operand_equal_p (pred2.pred_lhs, pred.pred_lhs, 0)
+	      && operand_equal_p (pred2.pred_rhs, pred.pred_rhs, 0)
+	      && pred2.invert == pred.invert)
+	    {
+	      found = true;
+	      break;
+	    }
+	}
       if (!found)
-        return false;
+	return false;
     }
   return true;
 }
 
 /* Forward declaration.  */
-static bool
-is_use_properly_guarded (gimple *use_stmt,
-                         basic_block use_bb,
-                         gphi *phi,
-                         unsigned uninit_opnds,
-			 pred_chain_union *def_preds,
-                         hash_set<gphi *> *visited_phis);
-
-/* Returns true if all uninitialized opnds are pruned. Returns false
-   otherwise. PHI is the phi node with uninitialized operands,
+static bool is_use_properly_guarded (gimple *use_stmt, basic_block use_bb,
+				     gphi *phi, unsigned uninit_opnds,
+				     pred_chain_union *def_preds,
+				     hash_set<gphi *> *visited_phis);
+
+/* Returns true if all uninitialized opnds are pruned.  Returns false
+   otherwise.  PHI is the phi node with uninitialized operands,
    UNINIT_OPNDS is the bitmap of the uninitialize operand positions,
    FLAG_DEF is the statement defining the flag guarding the use of the
    PHI output, BOUNDARY_CST is the const value used in the predicate
@@ -990,7 +962,7 @@ is_use_properly_guarded (gimple *use_stmt,
    Example scenario:
 
    BB1:
-   flag_1 = phi <0, 1>                  // (1)
+   flag_1 = phi <0, 1>		  // (1)
    var_1  = phi <undef, some_val>
 
 
@@ -1001,21 +973,20 @@ is_use_properly_guarded (gimple *use_stmt,
       goto BB3;
 
    BB3:
-   use of var_2                         // (3)
+   use of var_2			 // (3)
 
    Because some flag arg in (1) is not constant, if we do not look into the
    flag phis recursively, it is conservatively treated as unknown and var_1
-   is thought to be flowed into use at (3). Since var_1 is potentially uninitialized
-   a false warning will be emitted. Checking recursively into (1), the compiler can
-   find out that only some_val (which is defined) can flow into (3) which is OK.
+   is thought to be flowed into use at (3).  Since var_1 is potentially
+   uninitialized a false warning will be emitted.
+   Checking recursively into (1), the compiler can find out that only some_val
+   (which is defined) can flow into (3) which is OK.
 
 */
 
 static bool
-prune_uninit_phi_opnds_in_unrealizable_paths (gphi *phi,
-					      unsigned uninit_opnds,
-					      gphi *flag_def,
-					      tree boundary_cst,
+prune_uninit_phi_opnds_in_unrealizable_paths (gphi *phi, unsigned uninit_opnds,
+					      gphi *flag_def, tree boundary_cst,
 					      enum tree_code cmp_code,
 					      hash_set<gphi *> *visited_phis,
 					      bitmap *visited_flag_phis)
@@ -1027,89 +998,87 @@ prune_uninit_phi_opnds_in_unrealizable_paths (gphi *phi,
       tree flag_arg;
 
       if (!MASK_TEST_BIT (uninit_opnds, i))
-        continue;
+	continue;
 
       flag_arg = gimple_phi_arg_def (flag_def, i);
       if (!is_gimple_constant (flag_arg))
-        {
-          gphi *flag_arg_def, *phi_arg_def;
-          tree phi_arg;
-          unsigned uninit_opnds_arg_phi;
-
-          if (TREE_CODE (flag_arg) != SSA_NAME)
-            return false;
-          flag_arg_def = dyn_cast <gphi *> (SSA_NAME_DEF_STMT (flag_arg));
+	{
+	  gphi *flag_arg_def, *phi_arg_def;
+	  tree phi_arg;
+	  unsigned uninit_opnds_arg_phi;
+
+	  if (TREE_CODE (flag_arg) != SSA_NAME)
+	    return false;
+	  flag_arg_def = dyn_cast<gphi *> (SSA_NAME_DEF_STMT (flag_arg));
 	  if (!flag_arg_def)
-            return false;
+	    return false;
 
-          phi_arg = gimple_phi_arg_def (phi, i);
-          if (TREE_CODE (phi_arg) != SSA_NAME)
-            return false;
+	  phi_arg = gimple_phi_arg_def (phi, i);
+	  if (TREE_CODE (phi_arg) != SSA_NAME)
+	    return false;
 
-          phi_arg_def = dyn_cast <gphi *> (SSA_NAME_DEF_STMT (phi_arg));
+	  phi_arg_def = dyn_cast<gphi *> (SSA_NAME_DEF_STMT (phi_arg));
 	  if (!phi_arg_def)
-            return false;
+	    return false;
 
-          if (gimple_bb (phi_arg_def) != gimple_bb (flag_arg_def))
-            return false;
+	  if (gimple_bb (phi_arg_def) != gimple_bb (flag_arg_def))
+	    return false;
 
-          if (!*visited_flag_phis)
-            *visited_flag_phis = BITMAP_ALLOC (NULL);
+	  if (!*visited_flag_phis)
+	    *visited_flag_phis = BITMAP_ALLOC (NULL);
 
-          if (bitmap_bit_p (*visited_flag_phis,
-                            SSA_NAME_VERSION (gimple_phi_result (flag_arg_def))))
-            return false;
+	  if (bitmap_bit_p (*visited_flag_phis,
+			    SSA_NAME_VERSION (
+			      gimple_phi_result (flag_arg_def))))
+	    return false;
 
-          bitmap_set_bit (*visited_flag_phis,
-                          SSA_NAME_VERSION (gimple_phi_result (flag_arg_def)));
+	  bitmap_set_bit (*visited_flag_phis,
+			  SSA_NAME_VERSION (gimple_phi_result (flag_arg_def)));
 
-          /* Now recursively prune the uninitialized phi args.  */
-          uninit_opnds_arg_phi = compute_uninit_opnds_pos (phi_arg_def);
-          if (!prune_uninit_phi_opnds_in_unrealizable_paths
-		 (phi_arg_def, uninit_opnds_arg_phi, flag_arg_def,
-		  boundary_cst, cmp_code, visited_phis, visited_flag_phis))
-            return false;
+	  /* Now recursively prune the uninitialized phi args.  */
+	  uninit_opnds_arg_phi = compute_uninit_opnds_pos (phi_arg_def);
+	  if (!prune_uninit_phi_opnds_in_unrealizable_paths (
+		phi_arg_def, uninit_opnds_arg_phi, flag_arg_def, boundary_cst,
+		cmp_code, visited_phis, visited_flag_phis))
+	    return false;
 
-          bitmap_clear_bit (*visited_flag_phis,
-                            SSA_NAME_VERSION (gimple_phi_result (flag_arg_def)));
-          continue;
-        }
+	  bitmap_clear_bit (*visited_flag_phis,
+			    SSA_NAME_VERSION (
+			      gimple_phi_result (flag_arg_def)));
+	  continue;
+	}
 
       /* Now check if the constant is in the guarded range.  */
       if (is_value_included_in (flag_arg, boundary_cst, cmp_code))
-        {
-          tree opnd;
+	{
+	  tree opnd;
 	  gimple *opnd_def;
 
-          /* Now that we know that this undefined edge is not
-             pruned. If the operand is defined by another phi,
-             we can further prune the incoming edges of that
-             phi by checking the predicates of this operands.  */
-
-          opnd = gimple_phi_arg_def (phi, i);
-          opnd_def = SSA_NAME_DEF_STMT (opnd);
-          if (gphi *opnd_def_phi = dyn_cast <gphi *> (opnd_def))
-            {
-              edge opnd_edge;
-              unsigned uninit_opnds2
-                  = compute_uninit_opnds_pos (opnd_def_phi);
-              pred_chain_union def_preds = vNULL;
-              bool ok;
-              gcc_assert (!MASK_EMPTY (uninit_opnds2));
-              opnd_edge = gimple_phi_arg_edge (phi, i);
-              ok = is_use_properly_guarded (phi,
-					    opnd_edge->src,
-					    opnd_def_phi,
-					    uninit_opnds2,
-					    &def_preds,
+	  /* Now that we know that this undefined edge is not
+	     pruned.  If the operand is defined by another phi,
+	     we can further prune the incoming edges of that
+	     phi by checking the predicates of this operands.  */
+
+	  opnd = gimple_phi_arg_def (phi, i);
+	  opnd_def = SSA_NAME_DEF_STMT (opnd);
+	  if (gphi *opnd_def_phi = dyn_cast<gphi *> (opnd_def))
+	    {
+	      edge opnd_edge;
+	      unsigned uninit_opnds2 = compute_uninit_opnds_pos (opnd_def_phi);
+	      pred_chain_union def_preds = vNULL;
+	      bool ok;
+	      gcc_assert (!MASK_EMPTY (uninit_opnds2));
+	      opnd_edge = gimple_phi_arg_edge (phi, i);
+	      ok = is_use_properly_guarded (phi, opnd_edge->src, opnd_def_phi,
+					    uninit_opnds2, &def_preds,
 					    visited_phis);
 	      destroy_predicate_vecs (&def_preds);
 	      if (!ok)
 		return false;
-            }
-          else
-            return false;
-        }
+	    }
+	  else
+	    return false;
+	}
     }
 
   return true;
@@ -1119,50 +1088,50 @@ prune_uninit_phi_opnds_in_unrealizable_paths (gphi *phi,
    of the use is not overlapping with that of the uninit paths.
    The most common senario of guarded use is in Example 1:
      Example 1:
-           if (some_cond)
-           {
-              x = ...;
-              flag = true;
-           }
+	   if (some_cond)
+	   {
+	      x = ...;
+	      flag = true;
+	   }
 
-            ... some code ...
+	    ... some code ...
 
-           if (flag)
-              use (x);
+	   if (flag)
+	      use (x);
 
      The real world examples are usually more complicated, but similar
      and usually result from inlining:
 
-         bool init_func (int * x)
-         {
-             if (some_cond)
-                return false;
-             *x  =  ..
-             return true;
-         }
+	 bool init_func (int * x)
+	 {
+	     if (some_cond)
+		return false;
+	     *x  =  ..
+	     return true;
+	 }
 
-         void foo(..)
-         {
-             int x;
+	 void foo (..)
+	 {
+	     int x;
 
-             if (!init_func(&x))
-                return;
+	     if (!init_func (&x))
+		return;
 
-             .. some_code ...
-             use (x);
-         }
+	     .. some_code ...
+	     use (x);
+	 }
 
      Another possible use scenario is in the following trivial example:
 
      Example 2:
-          if (n > 0)
-             x = 1;
-          ...
-          if (n > 0)
-            {
-              if (m < 2)
-                 .. = x;
-            }
+	  if (n > 0)
+	     x = 1;
+	  ...
+	  if (n > 0)
+	    {
+	      if (m < 2)
+		 .. = x;
+	    }
 
      Predicate analysis needs to compute the composite predicate:
 
@@ -1173,11 +1142,11 @@ prune_uninit_phi_opnds_in_unrealizable_paths (gphi *phi,
        bb and is dominating the operand def.)
 
        and check overlapping:
-          (n > 0) .AND. (m < 2) .AND. (.NOT. (n > 0))
-        <==> false
+	  (n > 0) .AND. (m < 2) .AND. (.NOT. (n > 0))
+	<==> false
 
      This implementation provides framework that can handle
-     scenarios. (Note that many simple cases are handled properly
+     scenarios.  (Note that many simple cases are handled properly
      without the predicate analysis -- this is due to jump threading
      transformation which eliminates the merge point thus makes
      path sensitive analysis unnecessary.)
@@ -1185,18 +1154,17 @@ prune_uninit_phi_opnds_in_unrealizable_paths (gphi *phi,
      NUM_PREDS is the number is the number predicate chains, PREDS is
      the array of chains, PHI is the phi node whose incoming (undefined)
      paths need to be pruned, and UNINIT_OPNDS is the bitmap holding
-     uninit operand positions. VISITED_PHIS is the pointer set of phi
+     uninit operand positions.  VISITED_PHIS is the pointer set of phi
      stmts being checked.  */
 
-
 static bool
-use_pred_not_overlap_with_undef_path_pred (pred_chain_union preds,
-				           gphi *phi, unsigned uninit_opnds,
+use_pred_not_overlap_with_undef_path_pred (pred_chain_union preds, gphi *phi,
+					   unsigned uninit_opnds,
 					   hash_set<gphi *> *visited_phis)
 {
   unsigned int i, n;
   gimple *flag_def = 0;
-  tree  boundary_cst = 0;
+  tree boundary_cst = 0;
   enum tree_code cmp_code;
   bool swap_cond = false;
   bool invert = false;
@@ -1223,32 +1191,32 @@ use_pred_not_overlap_with_undef_path_pred (pred_chain_union preds,
       cmp_code = the_pred.cond_code;
 
       if (cond_lhs != NULL_TREE && TREE_CODE (cond_lhs) == SSA_NAME
-          && cond_rhs != NULL_TREE && is_gimple_constant (cond_rhs))
-        {
-          boundary_cst = cond_rhs;
-          flag = cond_lhs;
-        }
+	  && cond_rhs != NULL_TREE && is_gimple_constant (cond_rhs))
+	{
+	  boundary_cst = cond_rhs;
+	  flag = cond_lhs;
+	}
       else if (cond_rhs != NULL_TREE && TREE_CODE (cond_rhs) == SSA_NAME
-               && cond_lhs != NULL_TREE && is_gimple_constant (cond_lhs))
-        {
-          boundary_cst = cond_lhs;
-          flag = cond_rhs;
-          swap_cond = true;
-        }
+	       && cond_lhs != NULL_TREE && is_gimple_constant (cond_lhs))
+	{
+	  boundary_cst = cond_lhs;
+	  flag = cond_rhs;
+	  swap_cond = true;
+	}
 
       if (!flag)
-        continue;
+	continue;
 
       flag_def = SSA_NAME_DEF_STMT (flag);
 
       if (!flag_def)
-        continue;
+	continue;
 
       if ((gimple_code (flag_def) == GIMPLE_PHI)
-          && (gimple_bb (flag_def) == gimple_bb (phi))
-          && find_matching_predicate_in_rest_chains (the_pred, preds,
+	  && (gimple_bb (flag_def) == gimple_bb (phi))
+	  && find_matching_predicate_in_rest_chains (the_pred, preds,
 						     num_preds))
-        break;
+	break;
 
       flag_def = 0;
     }
@@ -1263,13 +1231,9 @@ use_pred_not_overlap_with_undef_path_pred (pred_chain_union preds,
   if (cmp_code == ERROR_MARK)
     return false;
 
-  all_pruned = prune_uninit_phi_opnds_in_unrealizable_paths (phi,
-                                                             uninit_opnds,
-                                                             as_a <gphi *> (flag_def),
-                                                             boundary_cst,
-                                                             cmp_code,
-                                                             visited_phis,
-                                                             &visited_flag_phis);
+  all_pruned = prune_uninit_phi_opnds_in_unrealizable_paths
+    (phi, uninit_opnds, as_a<gphi *> (flag_def), boundary_cst, cmp_code,
+     visited_phis, &visited_flag_phis);
 
   if (visited_flag_phis)
     BITMAP_FREE (visited_flag_phis);
@@ -1278,7 +1242,7 @@ use_pred_not_overlap_with_undef_path_pred (pred_chain_union preds,
 }
 
 /* The helper function returns true if two predicates X1 and X2
-   are equivalent. It assumes the expressions have already
+   are equivalent.  It assumes the expressions have already
    properly re-associated.  */
 
 static inline bool
@@ -1305,13 +1269,13 @@ static inline bool
 is_neq_relop_p (pred_info pred)
 {
 
-  return (pred.cond_code == NE_EXPR && !pred.invert) 
-          || (pred.cond_code == EQ_EXPR && pred.invert);
+  return (pred.cond_code == NE_EXPR && !pred.invert)
+	 || (pred.cond_code == EQ_EXPR && pred.invert);
 }
 
 /* Returns true if pred is of the form X != 0.  */
 
-static inline bool 
+static inline bool
 is_neq_zero_form_p (pred_info pred)
 {
   if (!is_neq_relop_p (pred) || !integer_zerop (pred.pred_rhs)
@@ -1333,7 +1297,7 @@ pred_expr_equal_p (pred_info x1, tree x2)
 }
 
 /* Returns true of the domain of single predicate expression
-   EXPR1 is a subset of that of EXPR2. Returns false if it
+   EXPR1 is a subset of that of EXPR2.  Returns false if it
    can not be proved.  */
 
 static bool
@@ -1358,8 +1322,7 @@ is_pred_expr_subset_of (pred_info expr1, pred_info expr2)
   if (expr2.invert)
     code2 = invert_tree_comparison (code2, false);
 
-  if ((code1 == EQ_EXPR || code1 == BIT_AND_EXPR)
-      && code2 == BIT_AND_EXPR)
+  if ((code1 == EQ_EXPR || code1 == BIT_AND_EXPR) && code2 == BIT_AND_EXPR)
     return wi::eq_p (expr1.pred_rhs,
 		     wi::bit_and (expr1.pred_rhs, expr2.pred_rhs));
 
@@ -1373,11 +1336,10 @@ is_pred_expr_subset_of (pred_info expr1, pred_info expr2)
 }
 
 /* Returns true if the domain of PRED1 is a subset
-   of that of PRED2. Returns false if it can not be proved so.  */
+   of that of PRED2.  Returns false if it can not be proved so.  */
 
 static bool
-is_pred_chain_subset_of (pred_chain pred1,
-                         pred_chain pred2)
+is_pred_chain_subset_of (pred_chain pred1, pred_chain pred2)
 {
   size_t np1, np2, i1, i2;
 
@@ -1389,23 +1351,23 @@ is_pred_chain_subset_of (pred_chain pred1,
       bool found = false;
       pred_info info2 = pred2[i2];
       for (i1 = 0; i1 < np1; i1++)
-        {
-          pred_info info1 = pred1[i1];
-          if (is_pred_expr_subset_of (info1, info2))
-            {
-              found = true;
-              break;
-            }
-        }
+	{
+	  pred_info info1 = pred1[i1];
+	  if (is_pred_expr_subset_of (info1, info2))
+	    {
+	      found = true;
+	      break;
+	    }
+	}
       if (!found)
-        return false;
+	return false;
     }
   return true;
 }
 
 /* Returns true if the domain defined by
    one pred chain ONE_PRED is a subset of the domain
-   of *PREDS. It returns false if ONE_PRED's domain is
+   of *PREDS.  It returns false if ONE_PRED's domain is
    not a subset of any of the sub-domains of PREDS
    (corresponding to each individual chains in it), even
    though it may be still be a subset of whole domain
@@ -1421,7 +1383,7 @@ is_included_in (pred_chain one_pred, pred_chain_union preds)
   for (i = 0; i < n; i++)
     {
       if (is_pred_chain_subset_of (one_pred, preds[i]))
-        return true;
+	return true;
     }
 
   return false;
@@ -1429,15 +1391,15 @@ is_included_in (pred_chain one_pred, pred_chain_union preds)
 
 /* Compares two predicate sets PREDS1 and PREDS2 and returns
    true if the domain defined by PREDS1 is a superset
-   of PREDS2's domain. N1 and N2 are array sizes of PREDS1 and
-   PREDS2 respectively. The implementation chooses not to build
+   of PREDS2's domain.  N1 and N2 are array sizes of PREDS1 and
+   PREDS2 respectively.  The implementation chooses not to build
    generic trees (and relying on the folding capability of the
    compiler), but instead performs brute force comparison of
    individual predicate chains (won't be a compile time problem
-   as the chains are pretty short). When the function returns
+   as the chains are pretty short).  When the function returns
    false, it does not necessarily mean *PREDS1 is not a superset
    of *PREDS2, but mean it may not be so since the analysis can
-   not prove it. In such cases, false warnings may still be
+   not prove it.  In such cases, false warnings may still be
    emitted.  */
 
 static bool
@@ -1452,7 +1414,7 @@ is_superset_of (pred_chain_union preds1, pred_chain_union preds2)
     {
       one_pred_chain = preds2[i];
       if (!is_included_in (one_pred_chain, preds1))
-        return false;
+	return false;
     }
 
   return true;
@@ -1463,9 +1425,8 @@ is_superset_of (pred_chain_union preds1, pred_chain_union preds2)
 static inline bool
 is_and_or_or_p (enum tree_code tc, tree type)
 {
-  return (tc == BIT_IOR_EXPR
-          || (tc == BIT_AND_EXPR
-              && (type == 0 || TREE_CODE (type) == BOOLEAN_TYPE)));
+  return tc == BIT_IOR_EXPR
+    || (tc == BIT_AND_EXPR && (type == 0 || TREE_CODE (type) == BOOLEAN_TYPE));
 }
 
 /* Returns true if X1 is the negate of X2.  */
@@ -1477,7 +1438,7 @@ pred_neg_p (pred_info x1, pred_info x2)
   if (!operand_equal_p (x1.pred_lhs, x2.pred_lhs, 0)
       || !operand_equal_p (x1.pred_rhs, x2.pred_rhs, 0))
     return false;
-      
+
   c1 = x1.cond_code;
   if (x1.invert == x2.invert)
     c2 = invert_tree_comparison (x2.cond_code, false);
@@ -1493,7 +1454,7 @@ pred_neg_p (pred_info x1, pred_info x2)
    4) ((x IAND y) != 0) || (x != 0 AND y != 0)) is equivalent to
       (x != 0 AND y != 0)
    5) (X AND Y) OR (!X AND Z) OR (!Y AND Z) is equivalent to
-      (X AND Y) OR Z 
+      (X AND Y) OR Z
 
    PREDS is the predicate chains, and N is the number of chains.  */
 
@@ -1514,50 +1475,50 @@ simplify_pred (pred_chain *one_chain)
       pred_info *a_pred = &(*one_chain)[i];
 
       if (!a_pred->pred_lhs)
-        continue;
+	continue;
       if (!is_neq_zero_form_p (*a_pred))
-        continue;
+	continue;
 
       gimple *def_stmt = SSA_NAME_DEF_STMT (a_pred->pred_lhs);
       if (gimple_code (def_stmt) != GIMPLE_ASSIGN)
-        continue;
+	continue;
       if (gimple_assign_rhs_code (def_stmt) == BIT_IOR_EXPR)
-        {
-          for (j = 0; j < n; j++)
-            {
-              pred_info *b_pred = &(*one_chain)[j];
-
-              if (!b_pred->pred_lhs)
-                continue;
-              if (!is_neq_zero_form_p (*b_pred))
-                continue;
-
-              if (pred_expr_equal_p (*b_pred, gimple_assign_rhs1 (def_stmt))
-                  || pred_expr_equal_p (*b_pred, gimple_assign_rhs2 (def_stmt)))
-                 {
-                   /* Mark a_pred for removal.  */
-                   a_pred->pred_lhs = NULL;
-                   a_pred->pred_rhs = NULL;
-                   simplified = true;
-                   break;
-                 }
-            }
-        }
+	{
+	  for (j = 0; j < n; j++)
+	    {
+	      pred_info *b_pred = &(*one_chain)[j];
+
+	      if (!b_pred->pred_lhs)
+		continue;
+	      if (!is_neq_zero_form_p (*b_pred))
+		continue;
+
+	      if (pred_expr_equal_p (*b_pred, gimple_assign_rhs1 (def_stmt))
+		  || pred_expr_equal_p (*b_pred, gimple_assign_rhs2 (def_stmt)))
+		{
+		  /* Mark a_pred for removal.  */
+		  a_pred->pred_lhs = NULL;
+		  a_pred->pred_rhs = NULL;
+		  simplified = true;
+		  break;
+		}
+	    }
+	}
     }
 
   if (!simplified)
-     return;
+    return;
 
   for (i = 0; i < n; i++)
     {
       pred_info *a_pred = &(*one_chain)[i];
       if (!a_pred->pred_lhs)
-        continue;
+	continue;
       s_chain.safe_push (*a_pred);
     }
 
-   one_chain->release ();
-   *one_chain = s_chain;
+  one_chain->release ();
+  *one_chain = s_chain;
 }
 
 /* The helper function implements the rule 2 for the
@@ -1572,7 +1533,7 @@ simplify_preds_2 (pred_chain_union *preds)
   bool simplified = false;
   pred_chain_union s_preds = vNULL;
 
-  /* (X AND Y) OR (!X AND Y) is equivalent to Y.  
+  /* (X AND Y) OR (!X AND Y) is equivalent to Y.
      (X AND Y) OR (X AND !Y) is equivalent to X.  */
 
   n = preds->length ();
@@ -1582,55 +1543,55 @@ simplify_preds_2 (pred_chain_union *preds)
       pred_chain *a_chain = &(*preds)[i];
 
       if (a_chain->length () != 2)
-        continue;
+	continue;
 
       x = (*a_chain)[0];
       y = (*a_chain)[1];
 
       for (j = 0; j < n; j++)
-        {
-          pred_chain *b_chain;
-          pred_info x2, y2;
-
-          if (j == i)
-            continue;
-
-          b_chain = &(*preds)[j];
-          if (b_chain->length () != 2)
-            continue;
-
-          x2 = (*b_chain)[0];
-          y2 = (*b_chain)[1];
-
-          if (pred_equal_p (x, x2) && pred_neg_p (y, y2))
-            {
-              /* Kill a_chain.  */
-              a_chain->release ();
-              b_chain->release ();
-              b_chain->safe_push (x);
-              simplified = true;
-              break;
-            }
-          if (pred_neg_p (x, x2) && pred_equal_p (y, y2))
-            {
-              /* Kill a_chain.  */
-              a_chain->release ();
-              b_chain->release ();
-              b_chain->safe_push (y);
-              simplified = true;
-              break;
-            }
-        }
+	{
+	  pred_chain *b_chain;
+	  pred_info x2, y2;
+
+	  if (j == i)
+	    continue;
+
+	  b_chain = &(*preds)[j];
+	  if (b_chain->length () != 2)
+	    continue;
+
+	  x2 = (*b_chain)[0];
+	  y2 = (*b_chain)[1];
+
+	  if (pred_equal_p (x, x2) && pred_neg_p (y, y2))
+	    {
+	      /* Kill a_chain.  */
+	      a_chain->release ();
+	      b_chain->release ();
+	      b_chain->safe_push (x);
+	      simplified = true;
+	      break;
+	    }
+	  if (pred_neg_p (x, x2) && pred_equal_p (y, y2))
+	    {
+	      /* Kill a_chain.  */
+	      a_chain->release ();
+	      b_chain->release ();
+	      b_chain->safe_push (y);
+	      simplified = true;
+	      break;
+	    }
+	}
     }
   /* Now clean up the chain.  */
   if (simplified)
     {
       for (i = 0; i < n; i++)
-        {
-          if ((*preds)[i].is_empty ())
-            continue;
-          s_preds.safe_push ((*preds)[i]);
-        }
+	{
+	  if ((*preds)[i].is_empty ())
+	    continue;
+	  s_preds.safe_push ((*preds)[i]);
+	}
       preds->release ();
       (*preds) = s_preds;
       s_preds = vNULL;
@@ -1663,34 +1624,34 @@ simplify_preds_3 (pred_chain_union *preds)
       pred_chain *a_chain = &(*preds)[i];
 
       if (a_chain->length () != 1)
-        continue;
+	continue;
 
       x = (*a_chain)[0];
 
       for (j = 0; j < n; j++)
-        {
-          pred_chain *b_chain;
-          pred_info x2;
-          size_t k;
-
-          if (j == i)
-            continue;
-
-          b_chain = &(*preds)[j];
-          if (b_chain->length () < 2)
-            continue;
-
-          for (k = 0; k < b_chain->length (); k++)
-            {
-              x2 = (*b_chain)[k];
-              if (pred_neg_p (x, x2))
-                {
-                  b_chain->unordered_remove (k);
-                  simplified = true;
-                  break;
-                }
-            }
-        }
+	{
+	  pred_chain *b_chain;
+	  pred_info x2;
+	  size_t k;
+
+	  if (j == i)
+	    continue;
+
+	  b_chain = &(*preds)[j];
+	  if (b_chain->length () < 2)
+	    continue;
+
+	  for (k = 0; k < b_chain->length (); k++)
+	    {
+	      x2 = (*b_chain)[k];
+	      if (pred_neg_p (x, x2))
+		{
+		  b_chain->unordered_remove (k);
+		  simplified = true;
+		  break;
+		}
+	    }
+	}
     }
   return simplified;
 }
@@ -1716,59 +1677,58 @@ simplify_preds_4 (pred_chain_union *preds)
       pred_chain *a_chain = &(*preds)[i];
 
       if (a_chain->length () != 1)
-        continue;
+	continue;
 
       z = (*a_chain)[0];
 
       if (!is_neq_zero_form_p (z))
-        continue;
+	continue;
 
       def_stmt = SSA_NAME_DEF_STMT (z.pred_lhs);
       if (gimple_code (def_stmt) != GIMPLE_ASSIGN)
-        continue;
+	continue;
 
       if (gimple_assign_rhs_code (def_stmt) != BIT_AND_EXPR)
-        continue;
+	continue;
 
       for (j = 0; j < n; j++)
-        {
-          pred_chain *b_chain;
-          pred_info x2, y2;
-
-          if (j == i)
-            continue;
-
-          b_chain = &(*preds)[j];
-          if (b_chain->length () != 2)
-            continue;
-
-          x2 = (*b_chain)[0];
-          y2 = (*b_chain)[1];
-          if (!is_neq_zero_form_p (x2)
-              || !is_neq_zero_form_p (y2))
-            continue;
-
-          if ((pred_expr_equal_p (x2, gimple_assign_rhs1 (def_stmt))
-               && pred_expr_equal_p (y2, gimple_assign_rhs2 (def_stmt)))
-              || (pred_expr_equal_p (x2, gimple_assign_rhs2 (def_stmt))
-                  && pred_expr_equal_p (y2, gimple_assign_rhs1 (def_stmt))))
-            {
-              /* Kill a_chain.  */
-              a_chain->release ();
-              simplified = true;
-              break;
-            }
-        }
+	{
+	  pred_chain *b_chain;
+	  pred_info x2, y2;
+
+	  if (j == i)
+	    continue;
+
+	  b_chain = &(*preds)[j];
+	  if (b_chain->length () != 2)
+	    continue;
+
+	  x2 = (*b_chain)[0];
+	  y2 = (*b_chain)[1];
+	  if (!is_neq_zero_form_p (x2) || !is_neq_zero_form_p (y2))
+	    continue;
+
+	  if ((pred_expr_equal_p (x2, gimple_assign_rhs1 (def_stmt))
+	       && pred_expr_equal_p (y2, gimple_assign_rhs2 (def_stmt)))
+	      || (pred_expr_equal_p (x2, gimple_assign_rhs2 (def_stmt))
+		  && pred_expr_equal_p (y2, gimple_assign_rhs1 (def_stmt))))
+	    {
+	      /* Kill a_chain.  */
+	      a_chain->release ();
+	      simplified = true;
+	      break;
+	    }
+	}
     }
   /* Now clean up the chain.  */
   if (simplified)
     {
       for (i = 0; i < n; i++)
-        {
-          if ((*preds)[i].is_empty ())
-            continue;
-          s_preds.safe_push ((*preds)[i]);
-        }
+	{
+	  if ((*preds)[i].is_empty ())
+	    continue;
+	  s_preds.safe_push ((*preds)[i]);
+	}
 
       destroy_predicate_vecs (preds);
       (*preds) = s_preds;
@@ -1778,7 +1738,6 @@ simplify_preds_4 (pred_chain_union *preds)
   return simplified;
 }
 
-
 /* This function simplifies predicates in PREDS.  */
 
 static void
@@ -1804,24 +1763,24 @@ simplify_preds (pred_chain_union *preds, gimple *use_or_def, bool is_use)
     {
       changed = false;
       if (simplify_preds_2 (preds))
-        changed = true;
+	changed = true;
 
       /* Now iteratively simplify X OR (!X AND Z ..)
        into X OR (Z ...).  */
       if (simplify_preds_3 (preds))
-        changed = true;
+	changed = true;
 
       if (simplify_preds_4 (preds))
-        changed = true;
-
-    } while (changed);
+	changed = true;
+    }
+  while (changed);
 
   return;
 }
 
 /* This is a helper function which attempts to normalize predicate chains
-  by following UD chains. It basically builds up a big tree of either IOR
-  operations or AND operations, and convert the IOR tree into a 
+  by following UD chains.  It basically builds up a big tree of either IOR
+  operations or AND operations, and convert the IOR tree into a
   pred_chain_union or BIT_AND tree into a pred_chain.
   Example:
 
@@ -1846,7 +1805,7 @@ simplify_preds (pred_chain_union *preds, gimple *use_or_def, bool is_use)
 
  then _t != 0 will be normalized into a pred_chain:
    (_2 RELOP1 _1) AND (_5 RELOP2 _4) AND (_8 RELOP3 _7) AND (_0 != 0)
-   
+
   */
 
 /* This is a helper function that stores a PRED into NORM_PREDS.  */
@@ -1864,7 +1823,7 @@ push_pred (pred_chain_union *norm_preds, pred_info pred)
 
 inline static void
 push_to_worklist (tree op, vec<pred_info, va_heap, vl_ptr> *work_list,
-                  hash_set<tree> *mark_set)
+		  hash_set<tree> *mark_set)
 {
   if (mark_set->contains (op))
     return;
@@ -1893,7 +1852,7 @@ get_pred_info_from_cmp (gimple *cmp_assign)
 }
 
 /* Returns true if the PHI is a degenerated phi with
-   all args with the same value (relop). In that case, *PRED
+   all args with the same value (relop).  In that case, *PRED
    will be updated to that value.  */
 
 static bool
@@ -1913,8 +1872,7 @@ is_degenerated_phi (gimple *phi, pred_info *pred_p)
   def0 = SSA_NAME_DEF_STMT (op0);
   if (gimple_code (def0) != GIMPLE_ASSIGN)
     return false;
-  if (TREE_CODE_CLASS (gimple_assign_rhs_code (def0))
-      != tcc_comparison)
+  if (TREE_CODE_CLASS (gimple_assign_rhs_code (def0)) != tcc_comparison)
     return false;
   pred0 = get_pred_info_from_cmp (def0);
 
@@ -1925,76 +1883,72 @@ is_degenerated_phi (gimple *phi, pred_info *pred_p)
       tree op = gimple_phi_arg_def (phi, i);
 
       if (TREE_CODE (op) != SSA_NAME)
-        return false;
+	return false;
 
       def = SSA_NAME_DEF_STMT (op);
       if (gimple_code (def) != GIMPLE_ASSIGN)
-        return false;
-      if (TREE_CODE_CLASS (gimple_assign_rhs_code (def))
-          != tcc_comparison)
-        return false;
+	return false;
+      if (TREE_CODE_CLASS (gimple_assign_rhs_code (def)) != tcc_comparison)
+	return false;
       pred = get_pred_info_from_cmp (def);
       if (!pred_equal_p (pred, pred0))
-        return false;
+	return false;
     }
 
   *pred_p = pred0;
   return true;
 }
 
-/* Normalize one predicate PRED  
+/* Normalize one predicate PRED
    1) if PRED can no longer be normlized, put it into NORM_PREDS.
    2) otherwise if PRED is of the form x != 0, follow x's definition
       and put normalized predicates into WORK_LIST.  */
- 
+
 static void
-normalize_one_pred_1 (pred_chain_union *norm_preds, 
-                      pred_chain *norm_chain,
-                      pred_info pred,
-                      enum tree_code and_or_code,
-                      vec<pred_info, va_heap, vl_ptr> *work_list,
+normalize_one_pred_1 (pred_chain_union *norm_preds, pred_chain *norm_chain,
+		      pred_info pred, enum tree_code and_or_code,
+		      vec<pred_info, va_heap, vl_ptr> *work_list,
 		      hash_set<tree> *mark_set)
 {
   if (!is_neq_zero_form_p (pred))
     {
       if (and_or_code == BIT_IOR_EXPR)
-        push_pred (norm_preds, pred);
+	push_pred (norm_preds, pred);
       else
-        norm_chain->safe_push (pred);
+	norm_chain->safe_push (pred);
       return;
     }
 
   gimple *def_stmt = SSA_NAME_DEF_STMT (pred.pred_lhs);
- 
+
   if (gimple_code (def_stmt) == GIMPLE_PHI
       && is_degenerated_phi (def_stmt, &pred))
     work_list->safe_push (pred);
-  else if (gimple_code (def_stmt) == GIMPLE_PHI
-           && and_or_code == BIT_IOR_EXPR)
+  else if (gimple_code (def_stmt) == GIMPLE_PHI && and_or_code == BIT_IOR_EXPR)
     {
       int i, n;
       n = gimple_phi_num_args (def_stmt);
 
-      /* If we see non zero constant, we should punt. The predicate
+      /* If we see non zero constant, we should punt.  The predicate
        * should be one guarding the phi edge.  */
       for (i = 0; i < n; ++i)
-        {
-          tree op = gimple_phi_arg_def (def_stmt, i);
-          if (TREE_CODE (op) == INTEGER_CST && !integer_zerop (op))
-            {
-              push_pred (norm_preds, pred);
-              return;
-            }
-        }
+	{
+	  tree op = gimple_phi_arg_def (def_stmt, i);
+	  if (TREE_CODE (op) == INTEGER_CST && !integer_zerop (op))
+	    {
+	      push_pred (norm_preds, pred);
+	      return;
+	    }
+	}
 
       for (i = 0; i < n; ++i)
-        {
-          tree op = gimple_phi_arg_def (def_stmt, i);
-          if (integer_zerop (op))
-            continue;
+	{
+	  tree op = gimple_phi_arg_def (def_stmt, i);
+	  if (integer_zerop (op))
+	    continue;
 
-          push_to_worklist (op, work_list, mark_set);
-        }
+	  push_to_worklist (op, work_list, mark_set);
+	}
     }
   else if (gimple_code (def_stmt) != GIMPLE_ASSIGN)
     {
@@ -2046,8 +2000,7 @@ normalize_one_pred_1 (pred_chain_union *norm_preds,
 /* Normalize PRED and store the normalized predicates into NORM_PREDS.  */
 
 static void
-normalize_one_pred (pred_chain_union *norm_preds,
-                    pred_info pred)
+normalize_one_pred (pred_chain_union *norm_preds, pred_info pred)
 {
   vec<pred_info, va_heap, vl_ptr> work_list = vNULL;
   enum tree_code and_or_code = ERROR_MARK;
@@ -2062,17 +2015,15 @@ normalize_one_pred (pred_chain_union *norm_preds,
   gimple *def_stmt = SSA_NAME_DEF_STMT (pred.pred_lhs);
   if (gimple_code (def_stmt) == GIMPLE_ASSIGN)
     and_or_code = gimple_assign_rhs_code (def_stmt);
-  if (and_or_code != BIT_IOR_EXPR
-      && and_or_code != BIT_AND_EXPR)
+  if (and_or_code != BIT_IOR_EXPR && and_or_code != BIT_AND_EXPR)
     {
-      if (TREE_CODE_CLASS (and_or_code)
-          == tcc_comparison)
-        {
-          pred_info n_pred = get_pred_info_from_cmp (def_stmt);
-          push_pred (norm_preds, n_pred);
-        } 
-       else
-          push_pred (norm_preds, pred);
+      if (TREE_CODE_CLASS (and_or_code) == tcc_comparison)
+	{
+	  pred_info n_pred = get_pred_info_from_cmp (def_stmt);
+	  push_pred (norm_preds, n_pred);
+	}
+      else
+	push_pred (norm_preds, pred);
       return;
     }
 
@@ -2082,8 +2033,8 @@ normalize_one_pred (pred_chain_union *norm_preds,
   while (!work_list.is_empty ())
     {
       pred_info a_pred = work_list.pop ();
-      normalize_one_pred_1 (norm_preds, &norm_chain, a_pred,
-                            and_or_code, &work_list, &mark_set);
+      normalize_one_pred_1 (norm_preds, &norm_chain, a_pred, and_or_code,
+			    &work_list, &mark_set);
     }
   if (and_or_code == BIT_AND_EXPR)
     norm_preds->safe_push (norm_chain);
@@ -2092,8 +2043,7 @@ normalize_one_pred (pred_chain_union *norm_preds,
 }
 
 static void
-normalize_one_pred_chain (pred_chain_union *norm_preds,
-                          pred_chain one_chain)
+normalize_one_pred_chain (pred_chain_union *norm_preds, pred_chain one_chain)
 {
   vec<pred_info, va_heap, vl_ptr> work_list = vNULL;
   hash_set<tree> mark_set;
@@ -2109,8 +2059,8 @@ normalize_one_pred_chain (pred_chain_union *norm_preds,
   while (!work_list.is_empty ())
     {
       pred_info a_pred = work_list.pop ();
-      normalize_one_pred_1 (0, &norm_chain, a_pred,
-                            BIT_AND_EXPR, &work_list, &mark_set);
+      normalize_one_pred_1 (0, &norm_chain, a_pred, BIT_AND_EXPR, &work_list,
+			    &mark_set);
     }
 
   norm_preds->safe_push (norm_chain);
@@ -2135,37 +2085,37 @@ normalize_preds (pred_chain_union preds, gimple *use_or_def, bool is_use)
   for (i = 0; i < n; i++)
     {
       if (preds[i].length () != 1)
-        normalize_one_pred_chain (&norm_preds, preds[i]);
+	normalize_one_pred_chain (&norm_preds, preds[i]);
       else
-        {
-          normalize_one_pred (&norm_preds, preds[i][0]);
-          preds[i].release ();
-        }
+	{
+	  normalize_one_pred (&norm_preds, preds[i][0]);
+	  preds[i].release ();
+	}
     }
 
   if (dump_file)
     {
       fprintf (dump_file, "[AFTER NORMALIZATION -- ");
-      dump_predicates (use_or_def, norm_preds, is_use ? "[USE]:\n" : "[DEF]:\n");
+      dump_predicates (use_or_def, norm_preds,
+		       is_use ? "[USE]:\n" : "[DEF]:\n");
     }
 
   destroy_predicate_vecs (&preds);
   return norm_preds;
 }
 
-
 /* Computes the predicates that guard the use and checks
    if the incoming paths that have empty (or possibly
-   empty) definition can be pruned/filtered. The function returns
+   empty) definition can be pruned/filtered.  The function returns
    true if it can be determined that the use of PHI's def in
    USE_STMT is guarded with a predicate set not overlapping with
    predicate sets of all runtime paths that do not have a definition.
 
-   Returns false if it is not or it can not be determined. USE_BB is
+   Returns false if it is not or it can not be determined.  USE_BB is
    the bb of the use (for phi operand use, the bb is not the bb of
    the phi stmt, but the src bb of the operand edge).
 
-   UNINIT_OPNDS is a bit vector. If an operand of PHI is uninitialized, the
+   UNINIT_OPNDS is a bit vector.  If an operand of PHI is uninitialized, the
    corresponding bit in the vector is 1.  VISITED_PHIS is a pointer
    set of phis being visited.
 
@@ -2176,12 +2126,9 @@ normalize_preds (pred_chain_union preds, gimple *use_or_def, bool is_use)
    VISITED_PHIS is a pointer set of phis being visited.  */
 
 static bool
-is_use_properly_guarded (gimple *use_stmt,
-                         basic_block use_bb,
-                         gphi *phi,
-                         unsigned uninit_opnds,
-			 pred_chain_union *def_preds,
-                         hash_set<gphi *> *visited_phis)
+is_use_properly_guarded (gimple *use_stmt, basic_block use_bb, gphi *phi,
+			 unsigned uninit_opnds, pred_chain_union *def_preds,
+			 hash_set<gphi *> *visited_phis)
 {
   basic_block phi_bb;
   pred_chain_union preds = vNULL;
@@ -2204,7 +2151,7 @@ is_use_properly_guarded (gimple *use_stmt,
       return false;
     }
 
-  /* Try to prune the dead incoming phi edges. */
+  /* Try to prune the dead incoming phi edges.  */
   is_properly_guarded
     = use_pred_not_overlap_with_undef_path_pred (preds, phi, uninit_opnds,
 						 visited_phis);
@@ -2240,16 +2187,15 @@ is_use_properly_guarded (gimple *use_stmt,
 
 /* Searches through all uses of a potentially
    uninitialized variable defined by PHI and returns a use
-   statement if the use is not properly guarded. It returns
-   NULL if all uses are guarded. UNINIT_OPNDS is a bitvector
-   holding the position(s) of uninit PHI operands. WORKLIST
+   statement if the use is not properly guarded.  It returns
+   NULL if all uses are guarded.  UNINIT_OPNDS is a bitvector
+   holding the position(s) of uninit PHI operands.  WORKLIST
    is the vector of candidate phis that may be updated by this
-   function. ADDED_TO_WORKLIST is the pointer set tracking
+   function.  ADDED_TO_WORKLIST is the pointer set tracking
    if the new phi is already in the worklist.  */
 
 static gimple *
-find_uninit_use (gphi *phi, unsigned uninit_opnds,
-                 vec<gphi *> *worklist,
+find_uninit_use (gphi *phi, unsigned uninit_opnds, vec<gphi *> *worklist,
 		 hash_set<gphi *> *added_to_worklist)
 {
   tree phi_result;
@@ -2269,9 +2215,9 @@ find_uninit_use (gphi *phi, unsigned uninit_opnds,
       if (is_gimple_debug (use_stmt))
 	continue;
 
-      if (gphi *use_phi = dyn_cast <gphi *> (use_stmt))
-	use_bb = gimple_phi_arg_edge (use_phi,
-				      PHI_ARG_INDEX_FROM_USE (use_p))->src;
+      if (gphi *use_phi = dyn_cast<gphi *> (use_stmt))
+	use_bb
+	  = gimple_phi_arg_edge (use_phi, PHI_ARG_INDEX_FROM_USE (use_p))->src;
       else
 	use_bb = gimple_bb (use_stmt);
 
@@ -2281,10 +2227,10 @@ find_uninit_use (gphi *phi, unsigned uninit_opnds,
 	continue;
 
       if (dump_file && (dump_flags & TDF_DETAILS))
-        {
-          fprintf (dump_file, "[CHECK]: Found unguarded use: ");
-          print_gimple_stmt (dump_file, use_stmt, 0, 0);
-        }
+	{
+	  fprintf (dump_file, "[CHECK]: Found unguarded use: ");
+	  print_gimple_stmt (dump_file, use_stmt, 0, 0);
+	}
       /* Found one real use, return.  */
       if (gimple_code (use_stmt) != GIMPLE_PHI)
 	{
@@ -2293,18 +2239,18 @@ find_uninit_use (gphi *phi, unsigned uninit_opnds,
 	}
 
       /* Found a phi use that is not guarded,
-         add the phi to the worklist.  */
-      if (!added_to_worklist->add (as_a <gphi *> (use_stmt)))
-        {
-          if (dump_file && (dump_flags & TDF_DETAILS))
-            {
-              fprintf (dump_file, "[WORKLIST]: Update worklist with phi: ");
-              print_gimple_stmt (dump_file, use_stmt, 0, 0);
-            }
-
-          worklist->safe_push (as_a <gphi *> (use_stmt));
-          possibly_undefined_names->add (phi_result);
-        }
+	 add the phi to the worklist.  */
+      if (!added_to_worklist->add (as_a<gphi *> (use_stmt)))
+	{
+	  if (dump_file && (dump_flags & TDF_DETAILS))
+	    {
+	      fprintf (dump_file, "[WORKLIST]: Update worklist with phi: ");
+	      print_gimple_stmt (dump_file, use_stmt, 0, 0);
+	    }
+
+	  worklist->safe_push (as_a<gphi *> (use_stmt));
+	  possibly_undefined_names->add (phi_result);
+	}
     }
 
   destroy_predicate_vecs (&def_preds);
@@ -2313,15 +2259,15 @@ find_uninit_use (gphi *phi, unsigned uninit_opnds,
 
 /* Look for inputs to PHI that are SSA_NAMEs that have empty definitions
    and gives warning if there exists a runtime path from the entry to a
-   use of the PHI def that does not contain a definition. In other words,
-   the warning is on the real use. The more dead paths that can be pruned
-   by the compiler, the fewer false positives the warning is. WORKLIST
-   is a vector of candidate phis to be examined. ADDED_TO_WORKLIST is
+   use of the PHI def that does not contain a definition.  In other words,
+   the warning is on the real use.  The more dead paths that can be pruned
+   by the compiler, the fewer false positives the warning is.  WORKLIST
+   is a vector of candidate phis to be examined.  ADDED_TO_WORKLIST is
    a pointer set tracking if the new phi is added to the worklist or not.  */
 
 static void
 warn_uninitialized_phi (gphi *phi, vec<gphi *> *worklist,
-                        hash_set<gphi *> *added_to_worklist)
+			hash_set<gphi *> *added_to_worklist)
 {
   unsigned uninit_opnds;
   gimple *uninit_use_stmt = 0;
@@ -2335,7 +2281,7 @@ warn_uninitialized_phi (gphi *phi, vec<gphi *> *worklist,
 
   uninit_opnds = compute_uninit_opnds_pos (phi);
 
-  if  (MASK_EMPTY (uninit_opnds))
+  if (MASK_EMPTY (uninit_opnds))
     return;
 
   if (dump_file && (dump_flags & TDF_DETAILS))
@@ -2345,8 +2291,8 @@ warn_uninitialized_phi (gphi *phi, vec<gphi *> *worklist,
     }
 
   /* Now check if we have any use of the value without proper guard.  */
-  uninit_use_stmt = find_uninit_use (phi, uninit_opnds,
-                                     worklist, added_to_worklist);
+  uninit_use_stmt
+    = find_uninit_use (phi, uninit_opnds, worklist, added_to_worklist);
 
   /* All uses are properly guarded.  */
   if (!uninit_use_stmt)
@@ -2362,9 +2308,8 @@ warn_uninitialized_phi (gphi *phi, vec<gphi *> *worklist,
     loc = UNKNOWN_LOCATION;
   warn_uninit (OPT_Wmaybe_uninitialized, uninit_op, SSA_NAME_VAR (uninit_op),
 	       SSA_NAME_VAR (uninit_op),
-               "%qD may be used uninitialized in this function",
-               uninit_use_stmt, loc);
-
+	       "%qD may be used uninitialized in this function",
+	       uninit_use_stmt, loc);
 }
 
 static bool
@@ -2377,15 +2322,15 @@ namespace {
 
 const pass_data pass_data_late_warn_uninitialized =
 {
-  GIMPLE_PASS, /* type */
-  "uninit", /* name */
+  GIMPLE_PASS,   /* type */
+  "uninit",      /* name */
   OPTGROUP_NONE, /* optinfo_flags */
-  TV_NONE, /* tv_id */
-  PROP_ssa, /* properties_required */
-  0, /* properties_provided */
-  0, /* properties_destroyed */
-  0, /* todo_flags_start */
-  0, /* todo_flags_finish */
+  TV_NONE,       /* tv_id */
+  PROP_ssa,      /* properties_required */
+  0,		 /* properties_provided */
+  0,		 /* properties_destroyed */
+  0,		 /* todo_flags_start */
+  0,		 /* todo_flags_finish */
 };
 
 class pass_late_warn_uninitialized : public gimple_opt_pass
@@ -2393,15 +2338,28 @@ class pass_late_warn_uninitialized : public gimple_opt_pass
 public:
   pass_late_warn_uninitialized (gcc::context *ctxt)
     : gimple_opt_pass (pass_data_late_warn_uninitialized, ctxt)
-  {}
+  {
+  }
 
   /* opt_pass methods: */
-  opt_pass * clone () { return new pass_late_warn_uninitialized (m_ctxt); }
-  virtual bool gate (function *) { return gate_warn_uninitialized (); }
+  opt_pass *clone ();
+  virtual bool gate (function *);
   virtual unsigned int execute (function *);
 
 }; // class pass_late_warn_uninitialized
 
+opt_pass *
+pass_late_warn_uninitialized::clone ()
+{
+  return new pass_late_warn_uninitialized (m_ctxt);
+}
+
+bool
+pass_late_warn_uninitialized::gate (function *)
+{
+  return gate_warn_uninitialized ();
+}
+
 unsigned int
 pass_late_warn_uninitialized::execute (function *fun)
 {
@@ -2437,8 +2395,7 @@ pass_late_warn_uninitialized::execute (function *fun)
 	for (i = 0; i < n; ++i)
 	  {
 	    tree op = gimple_phi_arg_def (phi, i);
-	    if (TREE_CODE (op) == SSA_NAME
-		&& uninit_undefined_value_p (op))
+	    if (TREE_CODE (op) == SSA_NAME && uninit_undefined_value_p (op))
 	      {
 		worklist.safe_push (phi);
 		added_to_worklist.add (phi);
@@ -2475,12 +2432,11 @@ make_pass_late_warn_uninitialized (gcc::context *ctxt)
   return new pass_late_warn_uninitialized (ctxt);
 }
 
-
 static unsigned int
 execute_early_warn_uninitialized (void)
 {
   /* Currently, this pass runs always but
-     execute_late_warn_uninitialized only runs with optimization. With
+     execute_late_warn_uninitialized only runs with optimization.  With
      optimization we want to warn about possible uninitialized as late
      as possible, thus don't do it here.  However, without
      optimization we need to warn here about "may be uninitialized".  */
@@ -2488,27 +2444,26 @@ execute_early_warn_uninitialized (void)
 
   warn_uninitialized_vars (/*warn_possibly_uninitialized=*/!optimize);
 
-  /* Post-dominator information can not be reliably updated. Free it
+  /* Post-dominator information can not be reliably updated.  Free it
      after the use.  */
 
   free_dominance_info (CDI_POST_DOMINATORS);
   return 0;
 }
 
-
 namespace {
 
 const pass_data pass_data_early_warn_uninitialized =
 {
-  GIMPLE_PASS, /* type */
+  GIMPLE_PASS,		       /* type */
   "*early_warn_uninitialized", /* name */
-  OPTGROUP_NONE, /* optinfo_flags */
-  TV_TREE_UNINIT, /* tv_id */
-  PROP_ssa, /* properties_required */
-  0, /* properties_provided */
-  0, /* properties_destroyed */
-  0, /* todo_flags_start */
-  0, /* todo_flags_finish */
+  OPTGROUP_NONE,	       /* optinfo_flags */
+  TV_TREE_UNINIT,	       /* tv_id */
+  PROP_ssa,		       /* properties_required */
+  0,			       /* properties_provided */
+  0,			       /* properties_destroyed */
+  0,			       /* todo_flags_start */
+  0,			       /* todo_flags_finish */
 };
 
 class pass_early_warn_uninitialized : public gimple_opt_pass
@@ -2516,17 +2471,27 @@ class pass_early_warn_uninitialized : public gimple_opt_pass
 public:
   pass_early_warn_uninitialized (gcc::context *ctxt)
     : gimple_opt_pass (pass_data_early_warn_uninitialized, ctxt)
-  {}
+  {
+  }
 
   /* opt_pass methods: */
-  virtual bool gate (function *) { return gate_warn_uninitialized (); }
-  virtual unsigned int execute (function *)
-    {
-      return execute_early_warn_uninitialized ();
-    }
+  virtual bool gate (function *);
+  virtual unsigned int execute (function *);
 
 }; // class pass_early_warn_uninitialized
 
+bool
+pass_early_warn_uninitialized::gate (function *)
+{
+  return gate_warn_uninitialized ();
+}
+
+unsigned int
+pass_early_warn_uninitialized::execute (function *)
+{
+  return execute_early_warn_uninitialized ();
+}
+
 } // anon namespace
 
 gimple_opt_pass *
-- 
2.6.2



^ permalink raw reply	[flat|nested] 42+ messages in thread

* Re: [PATCH] Fix memory leaks in tree-ssa-uninit.c
  2015-11-18 14:23         ` Martin Liška
@ 2015-11-18 16:59           ` Jeff Law
  2015-11-19  0:50           ` Joseph Myers
  1 sibling, 0 replies; 42+ messages in thread
From: Jeff Law @ 2015-11-18 16:59 UTC (permalink / raw)
  To: Martin Liška, gcc-patches

On 11/18/2015 07:23 AM, Martin Liška wrote:
> On 11/13/2015 08:19 PM, Jeff Law wrote:
>> On 11/13/2015 09:58 AM, Martin Liška wrote:
>>> On 11/13/2015 05:32 PM, Jeff Law wrote:
>>>> On 11/13/2015 05:50 AM, Martin Liška wrote:
>>>>> Hello.
>>>>>
>>>>> Patch survives regbootstrap on x86_64-linux-gnu.
>>>>> Ready for trunk?
>>>>>
>>>>> Thanks,
>>>>> Martin
>>>>>
>>>>>
>>>>> 0001-Fix-memory-leaks-in-tree-ssa-uninit.c.patch
>>>>>
>>>>>
>>>>>    From 54851503251dee7a8bd074485db262715e628728 Mon Sep 17 00:00:00 2001
>>>>> From: marxin<mliska@suse.cz>
>>>>> Date: Fri, 13 Nov 2015 12:23:22 +0100
>>>>> Subject: [PATCH] Fix memory leaks in tree-ssa-uninit.c
>>>>>
>>>>> gcc/ChangeLog:
>>>>>
>>>>> 2015-11-13  Martin Liska<mliska@suse.cz>
>>>>>
>>>>>       * tree-ssa-uninit.c (convert_control_dep_chain_into_preds):
>>>>>       Fix GNU coding style.
>>>>>       (find_def_preds): Use auto_vec.
>>>>>       (destroy_predicate_vecs): Change signature of the function.
>>>>>       (prune_uninit_phi_opnds_in_unrealizable_paths): Use the
>>>>>       new signature.
>>>>>       (simplify_preds_4): Use destroy_predicate_vecs instread of
>>>>>       just releasing preds vector.
>>>>>       (normalize_preds): Likewise.
>>>>>       (is_use_properly_guarded): Use new signature of
>>>>>       destroy_predicate_vecs.
>>>>>       (find_uninit_use): Likewise.
>>>> OK.
>>>>
>>>> FWIW, there's all kinds of spaces vs tabs issues in this file.  I'm curious why you chose to fix convert_control_dep_chain_into_preds, but didn't change any others.
>>>
>>> Hi Jeff.
>>>
>>> Thanks for confirmation, you are right, it's full of coding style issues. I can change these if it would be desired?
>> It's probably a good thing to do.  Given it'd strictly be formatting, I'd even consider it post-stage1.
>>
>> jeff
>
> Hello.
>
> I'm sending the re-formatted source file.
>
> The source file was formatted by clang-format ([1]) and some hunk were manually re-formatted.
> No change in behavior.
>
> Patch can regbootstrap on x86_64-linux-gnu.
>
> Ready for trunk?
OK.

jeff

^ permalink raw reply	[flat|nested] 42+ messages in thread

* Re: [PATCH] Fix memory leaks in tree-ssa-uninit.c
  2015-11-18 14:23         ` Martin Liška
  2015-11-18 16:59           ` Jeff Law
@ 2015-11-19  0:50           ` Joseph Myers
  2015-11-19  0:57             ` Bernd Schmidt
  2015-11-19 10:17             ` Martin Liška
  1 sibling, 2 replies; 42+ messages in thread
From: Joseph Myers @ 2015-11-19  0:50 UTC (permalink / raw)
  To: Martin Liška; +Cc: gcc-patches, law

I don't think all the reformattings here are things we want to do globally 
for most source files.  E.g.

> @@ -75,18 +74,17 @@ get_mask_first_set_bit (unsigned mask)
>  static bool
>  has_undefined_value_p (tree t)
>  {
> -  return (ssa_undefined_value_p (t)
> -          || (possibly_undefined_names
> -              && possibly_undefined_names->contains (t)));
> +  return ssa_undefined_value_p (t)
> +	 || (possibly_undefined_names
> +	     && possibly_undefined_names->contains (t));

This seems plain wrong.  The GNU Coding Standards explicitly say that in 
such cases where a binary operator goes on the start of the next line, you 
should insert extra parentheses so that Emacs will get the indentation 
right (even though otherwise parentheses shouldn't be used with "return").  
So the old code was better.

>  static void
> -warn_uninit (enum opt_code wc, tree t, tree expr, tree var,
> -	     const char *gmsgid, void *data, location_t phiarg_loc)
> +warn_uninit (enum opt_code wc, tree t, tree expr, tree var, const char *gmsgid,
> +	     void *data, location_t phiarg_loc)

Just because it's OK to go up to an 80- or 79-column limit if necessary 
doesn't mean code should be reformatted to do so.  Breaking a bit before 
that is perfectly reasonable in general (and in some cases, the choice of 
where to break may be based on logical grouping of arguments).

> @@ -135,10 +133,9 @@ warn_uninit (enum opt_code wc, tree t, tree expr, tree var,
>  
>    /* TREE_NO_WARNING either means we already warned, or the front end
>       wishes to suppress the warning.  */
> -  if ((context
> -       && (gimple_no_warning_p (context)
> -	   || (gimple_assign_single_p (context)
> -	       && TREE_NO_WARNING (gimple_assign_rhs1 (context)))))
> +  if ((context && (gimple_no_warning_p (context)
> +		   || (gimple_assign_single_p (context)
> +		       && TREE_NO_WARNING (gimple_assign_rhs1 (context)))))

I think in cases such as this, putting the operator && on the start of the 
next line to make subsequent lines less-indented makes sense.  Again, the 
new formatting isn't incorrect, but that doesn't make it a desirable 
change.

> @@ -217,24 +212,20 @@ warn_uninitialized_vars (bool warn_possibly_uninitialized)
>  	     so must be limited which means we would miss warning
>  	     opportunities.  */
>  	  use = gimple_vuse (stmt);
> -	  if (use
> -	      && gimple_assign_single_p (stmt)
> -	      && !gimple_vdef (stmt)
> +	  if (use && gimple_assign_single_p (stmt) && !gimple_vdef (stmt)
>  	      && SSA_NAME_IS_DEFAULT_DEF (use))

I think there may be a preference, where it's necessary to use multiple 
lines (if the whole condition doesn't fit on one line) for a condition 
like this, for each "&& condition" to go on its own line, rather than some 
lines having multiple conditions.

>  	      /* Do not warn if it can be initialized outside this function.  */
> -	      if (TREE_CODE (base) != VAR_DECL
> -		  || DECL_HARD_REGISTER (base)
> +	      if (TREE_CODE (base) != VAR_DECL || DECL_HARD_REGISTER (base)
>  		  || is_global_var (base))

Likewise.

> @@ -2393,15 +2338,28 @@ class pass_late_warn_uninitialized : public gimple_opt_pass
>  public:
>    pass_late_warn_uninitialized (gcc::context *ctxt)
>      : gimple_opt_pass (pass_data_late_warn_uninitialized, ctxt)
> -  {}
> +  {
> +  }

Is that really what we want?

I think those examples are sufficient to illustrate the problems with 
automatic conversion from one correct format to another correct format (as 
opposed to fixing cases where the formatting is unambiguously incorrect, 
which covers plenty of the changes in this patch).

-- 
Joseph S. Myers
joseph@codesourcery.com

^ permalink raw reply	[flat|nested] 42+ messages in thread

* Re: [PATCH] Fix memory leaks in tree-ssa-uninit.c
  2015-11-19  0:50           ` Joseph Myers
@ 2015-11-19  0:57             ` Bernd Schmidt
  2015-11-19 10:17             ` Martin Liška
  1 sibling, 0 replies; 42+ messages in thread
From: Bernd Schmidt @ 2015-11-19  0:57 UTC (permalink / raw)
  To: Joseph Myers, Martin Liška; +Cc: gcc-patches, law

On 11/19/2015 01:50 AM, Joseph Myers wrote:
> I don't think all the reformattings here are things we want to do globally
> for most source files.

While I do appreciate the sentiment behind the patch, I agree with all 
of Joseph's points. Especially the clearly incorrect changes should be 
reverted if the patch has already been applied.

>> @@ -135,10 +133,9 @@ warn_uninit (enum opt_code wc, tree t, tree expr, tree var,
>>
>>     /* TREE_NO_WARNING either means we already warned, or the front end
>>        wishes to suppress the warning.  */
>> -  if ((context
>> -       && (gimple_no_warning_p (context)
>> -	   || (gimple_assign_single_p (context)
>> -	       && TREE_NO_WARNING (gimple_assign_rhs1 (context)))))
>> +  if ((context && (gimple_no_warning_p (context)
>> +		   || (gimple_assign_single_p (context)
>> +		       && TREE_NO_WARNING (gimple_assign_rhs1 (context)))))
>
> I think in cases such as this, putting the operator && on the start of the
> next line to make subsequent lines less-indented makes sense.  Again, the
> new formatting isn't incorrect, but that doesn't make it a desirable
> change.
>
>> @@ -217,24 +212,20 @@ warn_uninitialized_vars (bool warn_possibly_uninitialized)
>>   	     so must be limited which means we would miss warning
>>   	     opportunities.  */
>>   	  use = gimple_vuse (stmt);
>> -	  if (use
>> -	      && gimple_assign_single_p (stmt)
>> -	      && !gimple_vdef (stmt)
>> +	  if (use && gimple_assign_single_p (stmt) && !gimple_vdef (stmt)
>>   	      && SSA_NAME_IS_DEFAULT_DEF (use))
>
> I think there may be a preference, where it's necessary to use multiple
> lines (if the whole condition doesn't fit on one line) for a condition
> like this, for each "&& condition" to go on its own line, rather than some
> lines having multiple conditions.

These ones (and any others like them) I would also like to see reverted. 
Both of them are contrary to existing practice.


Bernd

^ permalink raw reply	[flat|nested] 42+ messages in thread

* Re: [PATCH] Fix memory leaks in tree-ssa-uninit.c
  2015-11-19  0:50           ` Joseph Myers
  2015-11-19  0:57             ` Bernd Schmidt
@ 2015-11-19 10:17             ` Martin Liška
  2015-11-19 13:58               ` Bernd Schmidt
  1 sibling, 1 reply; 42+ messages in thread
From: Martin Liška @ 2015-11-19 10:17 UTC (permalink / raw)
  To: gcc-patches, joseph

[-- Attachment #1: Type: text/plain, Size: 4535 bytes --]

On 11/19/2015 01:50 AM, Joseph Myers wrote:
> I don't think all the reformattings here are things we want to do globally
> for most source files.  E.g.
>
>> @@ -75,18 +74,17 @@ get_mask_first_set_bit (unsigned mask)
>>   static bool
>>   has_undefined_value_p (tree t)
>>   {
>> -  return (ssa_undefined_value_p (t)
>> -          || (possibly_undefined_names
>> -              && possibly_undefined_names->contains (t)));
>> +  return ssa_undefined_value_p (t)
>> +	 || (possibly_undefined_names
>> +	     && possibly_undefined_names->contains (t));
>
> This seems plain wrong.  The GNU Coding Standards explicitly say that in
> such cases where a binary operator goes on the start of the next line, you
> should insert extra parentheses so that Emacs will get the indentation
> right (even though otherwise parentheses shouldn't be used with "return").
> So the old code was better.
>
>>   static void
>> -warn_uninit (enum opt_code wc, tree t, tree expr, tree var,
>> -	     const char *gmsgid, void *data, location_t phiarg_loc)
>> +warn_uninit (enum opt_code wc, tree t, tree expr, tree var, const char *gmsgid,
>> +	     void *data, location_t phiarg_loc)
>
> Just because it's OK to go up to an 80- or 79-column limit if necessary
> doesn't mean code should be reformatted to do so.  Breaking a bit before
> that is perfectly reasonable in general (and in some cases, the choice of
> where to break may be based on logical grouping of arguments).
>
>> @@ -135,10 +133,9 @@ warn_uninit (enum opt_code wc, tree t, tree expr, tree var,
>>
>>     /* TREE_NO_WARNING either means we already warned, or the front end
>>        wishes to suppress the warning.  */
>> -  if ((context
>> -       && (gimple_no_warning_p (context)
>> -	   || (gimple_assign_single_p (context)
>> -	       && TREE_NO_WARNING (gimple_assign_rhs1 (context)))))
>> +  if ((context && (gimple_no_warning_p (context)
>> +		   || (gimple_assign_single_p (context)
>> +		       && TREE_NO_WARNING (gimple_assign_rhs1 (context)))))
>
> I think in cases such as this, putting the operator && on the start of the
> next line to make subsequent lines less-indented makes sense.  Again, the
> new formatting isn't incorrect, but that doesn't make it a desirable
> change.
>
>> @@ -217,24 +212,20 @@ warn_uninitialized_vars (bool warn_possibly_uninitialized)
>>   	     so must be limited which means we would miss warning
>>   	     opportunities.  */
>>   	  use = gimple_vuse (stmt);
>> -	  if (use
>> -	      && gimple_assign_single_p (stmt)
>> -	      && !gimple_vdef (stmt)
>> +	  if (use && gimple_assign_single_p (stmt) && !gimple_vdef (stmt)
>>   	      && SSA_NAME_IS_DEFAULT_DEF (use))
>
> I think there may be a preference, where it's necessary to use multiple
> lines (if the whole condition doesn't fit on one line) for a condition
> like this, for each "&& condition" to go on its own line, rather than some
> lines having multiple conditions.
>
>>   	      /* Do not warn if it can be initialized outside this function.  */
>> -	      if (TREE_CODE (base) != VAR_DECL
>> -		  || DECL_HARD_REGISTER (base)
>> +	      if (TREE_CODE (base) != VAR_DECL || DECL_HARD_REGISTER (base)
>>   		  || is_global_var (base))
>
> Likewise.
>
>> @@ -2393,15 +2338,28 @@ class pass_late_warn_uninitialized : public gimple_opt_pass
>>   public:
>>     pass_late_warn_uninitialized (gcc::context *ctxt)
>>       : gimple_opt_pass (pass_data_late_warn_uninitialized, ctxt)
>> -  {}
>> +  {
>> +  }


Hi Joseph.

Agree with you that logical expressions are not formatted by the tool ideally,
human interaction is highly needed. The same rule can be applied to function arguments,
where we have mixture of approaches:

a) maximally fill-up a line
b) logically separate group of arguments
c) put each argument on a separate line if it does not fit to the single line

As the patch hasn't been installed, I'm attaching v2, where I preserve original grouping of a function
arguments and logic expressions that are made of multiple operands should be fine.

>
> Is that really what we want?

The hunk is reverted.

>
> I think those examples are sufficient to illustrate the problems with
> automatic conversion from one correct format to another correct format (as
> opposed to fixing cases where the formatting is unambiguously incorrect,
> which covers plenty of the changes in this patch).
>

You are right, however as the original coding style was really broken, it was much easier
to use the tool and clean-up fall-out.

Waiting for thoughts related to v2.

Thanks,
Martin

[-- Attachment #2: 0001-Reformat-tree-ssa-uninit.c-v2.patch --]
[-- Type: text/x-patch, Size: 74704 bytes --]

From 17270f8aa982567142aae1dd97238a424e2bf2d6 Mon Sep 17 00:00:00 2001
From: marxin <mliska@suse.cz>
Date: Wed, 18 Nov 2015 10:20:11 +0100
Subject: [PATCH 1/2] Reformat tree-ssa-uninit.c

---
 gcc/tree-ssa-uninit.c | 1349 ++++++++++++++++++++++++-------------------------
 1 file changed, 668 insertions(+), 681 deletions(-)

diff --git a/gcc/tree-ssa-uninit.c b/gcc/tree-ssa-uninit.c
index 0709cce..c4ed2d7 100644
--- a/gcc/tree-ssa-uninit.c
+++ b/gcc/tree-ssa-uninit.c
@@ -35,16 +35,15 @@ along with GCC; see the file COPYING3.  If not see
 #include "tree-cfg.h"
 
 /* This implements the pass that does predicate aware warning on uses of
-   possibly uninitialized variables. The pass first collects the set of
-   possibly uninitialized SSA names. For each such name, it walks through
-   all its immediate uses. For each immediate use, it rebuilds the condition
-   expression (the predicate) that guards the use. The predicate is then
+   possibly uninitialized variables.  The pass first collects the set of
+   possibly uninitialized SSA names.  For each such name, it walks through
+   all its immediate uses.  For each immediate use, it rebuilds the condition
+   expression (the predicate) that guards the use.  The predicate is then
    examined to see if the variable is always defined under that same condition.
    This is done either by pruning the unrealizable paths that lead to the
    default definitions or by checking if the predicate set that guards the
    defining paths is a superset of the use predicate.  */
 
-
 /* Pointer set of potentially undefined ssa names, i.e.,
    ssa names that are defined by phi with operands that
    are not defined or potentially undefined.  */
@@ -56,7 +55,7 @@ static hash_set<tree> *possibly_undefined_names = 0;
 #define MASK_EMPTY(mask) (mask == 0)
 
 /* Returns the first bit position (starting from LSB)
-   in mask that is non zero. Returns -1 if the mask is empty.  */
+   in mask that is non zero.  Returns -1 if the mask is empty.  */
 static int
 get_mask_first_set_bit (unsigned mask)
 {
@@ -76,17 +75,16 @@ static bool
 has_undefined_value_p (tree t)
 {
   return (ssa_undefined_value_p (t)
-          || (possibly_undefined_names
-              && possibly_undefined_names->contains (t)));
+	  || (possibly_undefined_names
+	      && possibly_undefined_names->contains (t)));
 }
 
-
-
 /* Like has_undefined_value_p, but don't return true if TREE_NO_WARNING
    is set on SSA_NAME_VAR.  */
 
 static inline bool
-uninit_undefined_value_p (tree t) {
+uninit_undefined_value_p (tree t)
+{
   if (!has_undefined_value_p (t))
     return false;
   if (SSA_NAME_VAR (t) && TREE_NO_WARNING (SSA_NAME_VAR (t)))
@@ -112,7 +110,7 @@ uninit_undefined_value_p (tree t) {
 /* Emit a warning for EXPR based on variable VAR at the point in the
    program T, an SSA_NAME, is used being uninitialized.  The exact
    warning text is in MSGID and DATA is the gimple stmt with info about
-   the location in source code. When DATA is a GIMPLE_PHI, PHIARG_IDX
+   the location in source code.  When DATA is a GIMPLE_PHI, PHIARG_IDX
    gives which argument of the phi node to take the location from.  WC
    is the warning code.  */
 
@@ -149,8 +147,7 @@ warn_uninit (enum opt_code wc, tree t, tree expr, tree var,
   else
     location = DECL_SOURCE_LOCATION (var);
   location = linemap_resolve_location (line_table, location,
-				       LRK_SPELLING_LOCATION,
-				       NULL);
+				       LRK_SPELLING_LOCATION, NULL);
   cfun_loc = DECL_SOURCE_LOCATION (cfun->decl);
   xloc = expand_location (location);
   floc = expand_location (cfun_loc);
@@ -161,10 +158,8 @@ warn_uninit (enum opt_code wc, tree t, tree expr, tree var,
       if (location == DECL_SOURCE_LOCATION (var))
 	return;
       if (xloc.file != floc.file
-	  || linemap_location_before_p (line_table,
-					location, cfun_loc)
-	  || linemap_location_before_p (line_table,
-					cfun->function_end_locus,
+	  || linemap_location_before_p (line_table, location, cfun_loc)
+	  || linemap_location_before_p (line_table, cfun->function_end_locus,
 					location))
 	inform (DECL_SOURCE_LOCATION (var), "%qD was declared here", var);
     }
@@ -178,8 +173,9 @@ warn_uninitialized_vars (bool warn_possibly_uninitialized)
 
   FOR_EACH_BB_FN (bb, cfun)
     {
-      bool always_executed = dominated_by_p (CDI_POST_DOMINATORS,
-					     single_succ (ENTRY_BLOCK_PTR_FOR_FN (cfun)), bb);
+      bool always_executed
+	= dominated_by_p (CDI_POST_DOMINATORS,
+			  single_succ (ENTRY_BLOCK_PTR_FOR_FN (cfun)), bb);
       for (gsi = gsi_start_bb (bb); !gsi_end_p (gsi); gsi_next (&gsi))
 	{
 	  gimple *stmt = gsi_stmt (gsi);
@@ -196,13 +192,13 @@ warn_uninitialized_vars (bool warn_possibly_uninitialized)
 	    {
 	      use = USE_FROM_PTR (use_p);
 	      if (always_executed)
-		warn_uninit (OPT_Wuninitialized, use,
-			     SSA_NAME_VAR (use), SSA_NAME_VAR (use),
-			     "%qD is used uninitialized in this function",
-			     stmt, UNKNOWN_LOCATION);
+		warn_uninit (OPT_Wuninitialized, use, SSA_NAME_VAR (use),
+			     SSA_NAME_VAR (use),
+			     "%qD is used uninitialized in this function", stmt,
+			     UNKNOWN_LOCATION);
 	      else if (warn_possibly_uninitialized)
-		warn_uninit (OPT_Wmaybe_uninitialized, use,
-			     SSA_NAME_VAR (use), SSA_NAME_VAR (use),
+		warn_uninit (OPT_Wmaybe_uninitialized, use, SSA_NAME_VAR (use),
+			     SSA_NAME_VAR (use),
 			     "%qD may be used uninitialized in this function",
 			     stmt, UNKNOWN_LOCATION);
 	    }
@@ -232,9 +228,8 @@ warn_uninitialized_vars (bool warn_possibly_uninitialized)
 		continue;
 
 	      if (always_executed)
-		warn_uninit (OPT_Wuninitialized, use,
-			     gimple_assign_rhs1 (stmt), base,
-			     "%qE is used uninitialized in this function",
+		warn_uninit (OPT_Wuninitialized, use, gimple_assign_rhs1 (stmt),
+			     base, "%qE is used uninitialized in this function",
 			     stmt, UNKNOWN_LOCATION);
 	      else if (warn_possibly_uninitialized)
 		warn_uninit (OPT_Wmaybe_uninitialized, use,
@@ -250,9 +245,9 @@ warn_uninitialized_vars (bool warn_possibly_uninitialized)
 
 /* Checks if the operand OPND of PHI is defined by
    another phi with one operand defined by this PHI,
-   but the rest operands are all defined. If yes,
+   but the rest operands are all defined.  If yes,
    returns true to skip this operand as being
-   redundant. Can be enhanced to be more general.  */
+   redundant.  Can be enhanced to be more general.  */
 
 static bool
 can_skip_redundant_opnd (tree opnd, gimple *phi)
@@ -270,9 +265,9 @@ can_skip_redundant_opnd (tree opnd, gimple *phi)
     {
       tree op = gimple_phi_arg_def (op_def, i);
       if (TREE_CODE (op) != SSA_NAME)
-        continue;
+	continue;
       if (op != phi_def && uninit_undefined_value_p (op))
-        return false;
+	return false;
     }
 
   return true;
@@ -296,10 +291,10 @@ compute_uninit_opnds_pos (gphi *phi)
     {
       tree op = gimple_phi_arg_def (phi, i);
       if (TREE_CODE (op) == SSA_NAME
-          && uninit_undefined_value_p (op)
-          && !can_skip_redundant_opnd (op, phi))
+	  && uninit_undefined_value_p (op)
+	  && !can_skip_redundant_opnd (op, phi))
 	{
-          if (cfun->has_nonlocal_label || cfun->calls_setjmp)
+	  if (cfun->has_nonlocal_label || cfun->calls_setjmp)
 	    {
 	      /* Ignore SSA_NAMEs that appear on abnormal edges
 		 somewhere.  */
@@ -318,37 +313,35 @@ compute_uninit_opnds_pos (gphi *phi)
 static inline basic_block
 find_pdom (basic_block block)
 {
-   if (block == EXIT_BLOCK_PTR_FOR_FN (cfun))
-     return EXIT_BLOCK_PTR_FOR_FN (cfun);
-   else
-     {
-       basic_block bb
-           = get_immediate_dominator (CDI_POST_DOMINATORS, block);
-       if (! bb)
-	 return EXIT_BLOCK_PTR_FOR_FN (cfun);
-       return bb;
-     }
+  if (block == EXIT_BLOCK_PTR_FOR_FN (cfun))
+    return EXIT_BLOCK_PTR_FOR_FN (cfun);
+  else
+    {
+      basic_block bb = get_immediate_dominator (CDI_POST_DOMINATORS, block);
+      if (!bb)
+	return EXIT_BLOCK_PTR_FOR_FN (cfun);
+      return bb;
+    }
 }
 
-/* Find the immediate DOM of the specified
-   basic block BLOCK.  */
+/* Find the immediate DOM of the specified basic block BLOCK.  */
 
 static inline basic_block
 find_dom (basic_block block)
 {
-   if (block == ENTRY_BLOCK_PTR_FOR_FN (cfun))
-     return ENTRY_BLOCK_PTR_FOR_FN (cfun);
-   else
-     {
-       basic_block bb = get_immediate_dominator (CDI_DOMINATORS, block);
-       if (! bb)
-	 return ENTRY_BLOCK_PTR_FOR_FN (cfun);
-       return bb;
-     }
+  if (block == ENTRY_BLOCK_PTR_FOR_FN (cfun))
+    return ENTRY_BLOCK_PTR_FOR_FN (cfun);
+  else
+    {
+      basic_block bb = get_immediate_dominator (CDI_DOMINATORS, block);
+      if (!bb)
+	return ENTRY_BLOCK_PTR_FOR_FN (cfun);
+      return bb;
+    }
 }
 
 /* Returns true if BB1 is postdominating BB2 and BB1 is
-   not a loop exit bb. The loop exit bb check is simple and does
+   not a loop exit bb.  The loop exit bb check is simple and does
    not cover all cases.  */
 
 static bool
@@ -366,7 +359,7 @@ is_non_loop_exit_postdominating (basic_block bb1, basic_block bb2)
 /* Find the closest postdominator of a specified BB, which is control
    equivalent to BB.  */
 
-static inline  basic_block
+static inline basic_block
 find_control_equiv_block (basic_block bb)
 {
   basic_block pdom;
@@ -398,8 +391,8 @@ find_control_equiv_block (basic_block bb)
 
 static bool
 compute_control_dep_chain (basic_block bb, basic_block dep_bb,
-                           vec<edge> *cd_chains,
-                           size_t *num_chains,
+			   vec<edge> *cd_chains,
+			   size_t *num_chains,
 			   vec<edge> *cur_cd_chain,
 			   int *num_calls)
 {
@@ -424,9 +417,9 @@ compute_control_dep_chain (basic_block bb, basic_block dep_bb,
   for (i = 0; i < cur_chain_len; i++)
     {
       edge e = (*cur_cd_chain)[i];
-      /* Cycle detected. */
+      /* Cycle detected.  */
       if (e->src == bb)
-        return false;
+	return false;
     }
 
   FOR_EACH_EDGE (e, ei, bb->succs)
@@ -434,39 +427,39 @@ compute_control_dep_chain (basic_block bb, basic_block dep_bb,
       basic_block cd_bb;
       int post_dom_check = 0;
       if (e->flags & (EDGE_FAKE | EDGE_ABNORMAL))
-        continue;
+	continue;
 
       cd_bb = e->dest;
       cur_cd_chain->safe_push (e);
       while (!is_non_loop_exit_postdominating (cd_bb, bb))
-        {
-          if (cd_bb == dep_bb)
-            {
-              /* Found a direct control dependence.  */
-              if (*num_chains < MAX_NUM_CHAINS)
-                {
-                  cd_chains[*num_chains] = cur_cd_chain->copy ();
-                  (*num_chains)++;
-                }
-              found_cd_chain = true;
-              /* Check path from next edge.  */
-              break;
-            }
-
-          /* Now check if DEP_BB is indirectly control dependent on BB.  */
-          if (compute_control_dep_chain (cd_bb, dep_bb, cd_chains,
-					 num_chains, cur_cd_chain, num_calls))
-            {
-              found_cd_chain = true;
-              break;
-            }
-
-          cd_bb = find_pdom (cd_bb);
-          post_dom_check++;
-	  if (cd_bb == EXIT_BLOCK_PTR_FOR_FN (cfun) || post_dom_check >
-	      MAX_POSTDOM_CHECK)
-            break;
-        }
+	{
+	  if (cd_bb == dep_bb)
+	    {
+	      /* Found a direct control dependence.  */
+	      if (*num_chains < MAX_NUM_CHAINS)
+		{
+		  cd_chains[*num_chains] = cur_cd_chain->copy ();
+		  (*num_chains)++;
+		}
+	      found_cd_chain = true;
+	      /* Check path from next edge.  */
+	      break;
+	    }
+
+	  /* Now check if DEP_BB is indirectly control dependent on BB.  */
+	  if (compute_control_dep_chain (cd_bb, dep_bb, cd_chains, num_chains,
+					 cur_cd_chain, num_calls))
+	    {
+	      found_cd_chain = true;
+	      break;
+	    }
+
+	  cd_bb = find_pdom (cd_bb);
+	  post_dom_check++;
+	  if (cd_bb == EXIT_BLOCK_PTR_FOR_FN (cfun)
+	      || post_dom_check > MAX_POSTDOM_CHECK)
+	    break;
+	}
       cur_cd_chain->pop ();
       gcc_assert (cur_cd_chain->length () == cur_chain_len);
     }
@@ -475,7 +468,7 @@ compute_control_dep_chain (basic_block bb, basic_block dep_bb,
   return found_cd_chain;
 }
 
-/* The type to represent a simple predicate  */
+/* The type to represent a simple predicate.  */
 
 struct pred_info
 {
@@ -496,20 +489,20 @@ typedef vec<pred_info, va_heap, vl_ptr> pred_chain;
 typedef vec<pred_chain, va_heap, vl_ptr> pred_chain_union;
 
 /* Converts the chains of control dependence edges into a set of
-   predicates. A control dependence chain is represented by a vector
-   edges. DEP_CHAINS points to an array of dependence chains.
-   NUM_CHAINS is the size of the chain array. One edge in a dependence
+   predicates.  A control dependence chain is represented by a vector
+   edges.  DEP_CHAINS points to an array of dependence chains.
+   NUM_CHAINS is the size of the chain array.  One edge in a dependence
    chain is mapped to predicate expression represented by pred_info
-   type. One dependence chain is converted to a composite predicate that
+   type.  One dependence chain is converted to a composite predicate that
    is the result of AND operation of pred_info mapped to each edge.
-   A composite predicate is presented by a vector of pred_info. On
+   A composite predicate is presented by a vector of pred_info.  On
    return, *PREDS points to the resulting array of composite predicates.
    *NUM_PREDS is the number of composite predictes.  */
 
 static bool
 convert_control_dep_chain_into_preds (vec<edge> *dep_chains,
-                                      size_t num_chains,
-                                      pred_chain_union *preds)
+				      size_t num_chains,
+				      pred_chain_union *preds)
 {
   bool has_valid_pred = false;
   size_t i, j;
@@ -527,48 +520,47 @@ convert_control_dep_chain_into_preds (vec<edge> *dep_chains,
       has_valid_pred = false;
       pred_chain t_chain = vNULL;
       for (j = 0; j < one_cd_chain.length (); j++)
-        {
+	{
 	  gimple *cond_stmt;
-          gimple_stmt_iterator gsi;
-          basic_block guard_bb;
-          pred_info one_pred;
-          edge e;
-
-          e = one_cd_chain[j];
-          guard_bb = e->src;
-          gsi = gsi_last_bb (guard_bb);
-          if (gsi_end_p (gsi))
-            {
-              has_valid_pred = false;
-              break;
-            }
-          cond_stmt = gsi_stmt (gsi);
-          if (is_gimple_call (cond_stmt)
-              && EDGE_COUNT (e->src->succs) >= 2)
-            {
-              /* Ignore EH edge. Can add assertion
-                 on the other edge's flag.  */
-              continue;
-            }
-          /* Skip if there is essentially one succesor.  */
-          if (EDGE_COUNT (e->src->succs) == 2)
-            {
-              edge e1;
-              edge_iterator ei1;
-              bool skip = false;
-
-              FOR_EACH_EDGE (e1, ei1, e->src->succs)
-                {
-                  if (EDGE_COUNT (e1->dest->succs) == 0)
-                    {
-                      skip = true;
-                      break;
-                    }
-                }
-              if (skip)
-                continue;
-            }
-          if (gimple_code (cond_stmt) == GIMPLE_COND)
+	  gimple_stmt_iterator gsi;
+	  basic_block guard_bb;
+	  pred_info one_pred;
+	  edge e;
+
+	  e = one_cd_chain[j];
+	  guard_bb = e->src;
+	  gsi = gsi_last_bb (guard_bb);
+	  if (gsi_end_p (gsi))
+	    {
+	      has_valid_pred = false;
+	      break;
+	    }
+	  cond_stmt = gsi_stmt (gsi);
+	  if (is_gimple_call (cond_stmt) && EDGE_COUNT (e->src->succs) >= 2)
+	    {
+	      /* Ignore EH edge.  Can add assertion
+		 on the other edge's flag.  */
+	      continue;
+	    }
+	  /* Skip if there is essentially one succesor.  */
+	  if (EDGE_COUNT (e->src->succs) == 2)
+	    {
+	      edge e1;
+	      edge_iterator ei1;
+	      bool skip = false;
+
+	      FOR_EACH_EDGE (e1, ei1, e->src->succs)
+		{
+		  if (EDGE_COUNT (e1->dest->succs) == 0)
+		    {
+		      skip = true;
+		      break;
+		    }
+		}
+	      if (skip)
+		continue;
+	    }
+	  if (gimple_code (cond_stmt) == GIMPLE_COND)
 	    {
 	      one_pred.pred_lhs = gimple_cond_lhs (cond_stmt);
 	      one_pred.pred_rhs = gimple_cond_rhs (cond_stmt);
@@ -577,7 +569,7 @@ convert_control_dep_chain_into_preds (vec<edge> *dep_chains,
 	      t_chain.safe_push (one_pred);
 	      has_valid_pred = true;
 	    }
-	  else if (gswitch *gs = dyn_cast <gswitch *> (cond_stmt))
+	  else if (gswitch *gs = dyn_cast<gswitch *> (cond_stmt))
 	    {
 	      /* Avoid quadratic behavior.  */
 	      if (gimple_switch_num_labels (gs) > MAX_SWITCH_CASES)
@@ -603,12 +595,12 @@ convert_control_dep_chain_into_preds (vec<edge> *dep_chains,
 		    }
 		}
 	      /* If more than one label reaches this block or the case
-	         label doesn't have a single value (like the default one)
+		 label doesn't have a single value (like the default one)
 		 fail.  */
 	      if (!l
 		  || !CASE_LOW (l)
-		  || (CASE_HIGH (l) && !operand_equal_p (CASE_LOW (l),
-							 CASE_HIGH (l), 0)))
+		  || (CASE_HIGH (l)
+		      && !operand_equal_p (CASE_LOW (l), CASE_HIGH (l), 0)))
 		{
 		  has_valid_pred = false;
 		  break;
@@ -621,11 +613,11 @@ convert_control_dep_chain_into_preds (vec<edge> *dep_chains,
 	      has_valid_pred = true;
 	    }
 	  else
-            {
-              has_valid_pred = false;
-              break;
-            }
-        }
+	    {
+	      has_valid_pred = false;
+	      break;
+	    }
+	}
 
       if (!has_valid_pred)
 	break;
@@ -635,15 +627,15 @@ convert_control_dep_chain_into_preds (vec<edge> *dep_chains,
   return has_valid_pred;
 }
 
-/* Computes all control dependence chains for USE_BB. The control
+/* Computes all control dependence chains for USE_BB.  The control
    dependence chains are then converted to an array of composite
    predicates pointed to by PREDS.  PHI_BB is the basic block of
    the phi whose result is used in USE_BB.  */
 
 static bool
 find_predicates (pred_chain_union *preds,
-                 basic_block phi_bb,
-                 basic_block use_bb)
+		 basic_block phi_bb,
+		 basic_block use_bb)
 {
   size_t num_chains = 0, i;
   int num_calls = 0;
@@ -659,9 +651,9 @@ find_predicates (pred_chain_union *preds,
     {
       basic_block ctrl_eq_bb = find_control_equiv_block (cd_root);
       if (ctrl_eq_bb && dominated_by_p (CDI_DOMINATORS, use_bb, ctrl_eq_bb))
-        cd_root = ctrl_eq_bb;
+	cd_root = ctrl_eq_bb;
       else
-        break;
+	break;
     }
 
   compute_control_dep_chain (cd_root, use_bb, dep_chains, &num_chains,
@@ -676,8 +668,8 @@ find_predicates (pred_chain_union *preds,
 
 /* Computes the set of incoming edges of PHI that have non empty
    definitions of a phi chain.  The collection will be done
-   recursively on operands that are defined by phis. CD_ROOT
-   is the control dependence root. *EDGES holds the result, and
+   recursively on operands that are defined by phis.  CD_ROOT
+   is the control dependence root.  *EDGES holds the result, and
    VISITED_PHIS is a pointer set for detecting cycles.  */
 
 static void
@@ -699,33 +691,33 @@ collect_phi_def_edges (gphi *phi, basic_block cd_root,
       opnd = gimple_phi_arg_def (phi, i);
 
       if (TREE_CODE (opnd) != SSA_NAME)
-        {
-          if (dump_file && (dump_flags & TDF_DETAILS))
-            {
-              fprintf (dump_file, "\n[CHECK] Found def edge %d in ", (int)i);
-              print_gimple_stmt (dump_file, phi, 0, 0);
-            }
-          edges->safe_push (opnd_edge);
-        }
+	{
+	  if (dump_file && (dump_flags & TDF_DETAILS))
+	    {
+	      fprintf (dump_file, "\n[CHECK] Found def edge %d in ", (int) i);
+	      print_gimple_stmt (dump_file, phi, 0, 0);
+	    }
+	  edges->safe_push (opnd_edge);
+	}
       else
-        {
+	{
 	  gimple *def = SSA_NAME_DEF_STMT (opnd);
 
-          if (gimple_code (def) == GIMPLE_PHI
-              && dominated_by_p (CDI_DOMINATORS,
-                                 gimple_bb (def), cd_root))
-            collect_phi_def_edges (as_a <gphi *> (def), cd_root, edges,
-                                   visited_phis);
-          else if (!uninit_undefined_value_p (opnd))
-            {
-              if (dump_file && (dump_flags & TDF_DETAILS))
-                {
-                  fprintf (dump_file, "\n[CHECK] Found def edge %d in ", (int)i);
-                  print_gimple_stmt (dump_file, phi, 0, 0);
-                }
-              edges->safe_push (opnd_edge);
-            }
-        }
+	  if (gimple_code (def) == GIMPLE_PHI
+	      && dominated_by_p (CDI_DOMINATORS, gimple_bb (def), cd_root))
+	    collect_phi_def_edges (as_a<gphi *> (def), cd_root, edges,
+				   visited_phis);
+	  else if (!uninit_undefined_value_p (opnd))
+	    {
+	      if (dump_file && (dump_flags & TDF_DETAILS))
+		{
+		  fprintf (dump_file, "\n[CHECK] Found def edge %d in ",
+			   (int) i);
+		  print_gimple_stmt (dump_file, phi, 0, 0);
+		}
+	      edges->safe_push (opnd_edge);
+	    }
+	}
     }
 }
 
@@ -745,7 +737,7 @@ find_def_preds (pred_chain_union *preds, gphi *phi)
 
   phi_bb = gimple_bb (phi);
   /* First find the closest dominating bb to be
-     the control dependence root  */
+     the control dependence root.  */
   cd_root = find_dom (phi_bb);
   if (!cd_root)
     return false;
@@ -769,14 +761,14 @@ find_def_preds (pred_chain_union *preds, gphi *phi)
 				 &num_chains, &cur_chain, &num_calls);
 
       /* Now update the newly added chains with
-         the phi operand edge:  */
+	 the phi operand edge:  */
       if (EDGE_COUNT (opnd_edge->src->succs) > 1)
-        {
+	{
 	  if (prev_nc == num_chains && num_chains < MAX_NUM_CHAINS)
 	    dep_chains[num_chains++] = vNULL;
-          for (j = prev_nc; j < num_chains; j++)
+	  for (j = prev_nc; j < num_chains; j++)
 	    dep_chains[j].safe_push (opnd_edge);
-        }
+	}
     }
 
   has_valid_pred
@@ -789,8 +781,7 @@ find_def_preds (pred_chain_union *preds, gphi *phi)
 /* Dumps the predicates (PREDS) for USESTMT.  */
 
 static void
-dump_predicates (gimple *usestmt, pred_chain_union preds,
-                 const char* msg)
+dump_predicates (gimple *usestmt, pred_chain_union preds, const char *msg)
 {
   size_t i, j;
   pred_chain one_pred_chain = vNULL;
@@ -807,22 +798,22 @@ dump_predicates (gimple *usestmt, pred_chain_union preds,
       np = one_pred_chain.length ();
 
       for (j = 0; j < np; j++)
-        {
-          pred_info one_pred = one_pred_chain[j];
-          if (one_pred.invert)
-            fprintf (dump_file, " (.NOT.) ");
-          print_generic_expr (dump_file, one_pred.pred_lhs, 0);
-          fprintf (dump_file, " %s ", op_symbol_code (one_pred.cond_code));
-          print_generic_expr (dump_file, one_pred.pred_rhs, 0);
-          if (j < np - 1)
-            fprintf (dump_file, " (.AND.) ");
-          else
-            fprintf (dump_file, "\n");
-        }
+	{
+	  pred_info one_pred = one_pred_chain[j];
+	  if (one_pred.invert)
+	    fprintf (dump_file, " (.NOT.) ");
+	  print_generic_expr (dump_file, one_pred.pred_lhs, 0);
+	  fprintf (dump_file, " %s ", op_symbol_code (one_pred.cond_code));
+	  print_generic_expr (dump_file, one_pred.pred_rhs, 0);
+	  if (j < np - 1)
+	    fprintf (dump_file, " (.AND.) ");
+	  else
+	    fprintf (dump_file, "\n");
+	}
       if (i < num_preds - 1)
-        fprintf (dump_file, "(.OR.)\n");
+	fprintf (dump_file, "(.OR.)\n");
       else
-        fprintf (dump_file, "\n\n");
+	fprintf (dump_file, "\n\n");
     }
 }
 
@@ -839,13 +830,11 @@ destroy_predicate_vecs (pred_chain_union *preds)
   preds->release ();
 }
 
-
 /* Computes the 'normalized' conditional code with operand
    swapping and condition inversion.  */
 
 static enum tree_code
-get_cmp_code (enum tree_code orig_cmp_code,
-              bool swap_cond, bool invert)
+get_cmp_code (enum tree_code orig_cmp_code, bool swap_cond, bool invert)
 {
   enum tree_code tc = orig_cmp_code;
 
@@ -880,14 +869,12 @@ is_value_included_in (tree val, tree boundary, enum tree_code cmpc)
   bool result;
 
   /* Only handle integer constant here.  */
-  if (TREE_CODE (val) != INTEGER_CST
-      || TREE_CODE (boundary) != INTEGER_CST)
+  if (TREE_CODE (val) != INTEGER_CST || TREE_CODE (boundary) != INTEGER_CST)
     return true;
 
   is_unsigned = TYPE_UNSIGNED (TREE_TYPE (val));
 
-  if (cmpc == GE_EXPR || cmpc == GT_EXPR
-      || cmpc == NE_EXPR)
+  if (cmpc == GE_EXPR || cmpc == GT_EXPR || cmpc == NE_EXPR)
     {
       cmpc = invert_tree_comparison (cmpc, false);
       inverted = true;
@@ -896,27 +883,27 @@ is_value_included_in (tree val, tree boundary, enum tree_code cmpc)
   if (is_unsigned)
     {
       if (cmpc == EQ_EXPR)
-        result = tree_int_cst_equal (val, boundary);
+	result = tree_int_cst_equal (val, boundary);
       else if (cmpc == LT_EXPR)
-        result = tree_int_cst_lt (val, boundary);
+	result = tree_int_cst_lt (val, boundary);
       else
-        {
-          gcc_assert (cmpc == LE_EXPR);
-          result = tree_int_cst_le (val, boundary);
-        }
+	{
+	  gcc_assert (cmpc == LE_EXPR);
+	  result = tree_int_cst_le (val, boundary);
+	}
     }
   else
     {
       if (cmpc == EQ_EXPR)
-        result = tree_int_cst_equal (val, boundary);
+	result = tree_int_cst_equal (val, boundary);
       else if (cmpc == LT_EXPR)
-        result = tree_int_cst_lt (val, boundary);
+	result = tree_int_cst_lt (val, boundary);
       else
-        {
-          gcc_assert (cmpc == LE_EXPR);
-          result = (tree_int_cst_equal (val, boundary)
-                    || tree_int_cst_lt (val, boundary));
-        }
+	{
+	  gcc_assert (cmpc == LE_EXPR);
+	  result = (tree_int_cst_equal (val, boundary)
+		    || tree_int_cst_lt (val, boundary));
+	}
     }
 
   if (inverted)
@@ -931,8 +918,8 @@ is_value_included_in (tree val, tree boundary, enum tree_code cmpc)
 
 static bool
 find_matching_predicate_in_rest_chains (pred_info pred,
-                                        pred_chain_union preds,
-                                        size_t num_pred_chains)
+					pred_chain_union preds,
+					size_t num_pred_chains)
 {
   size_t i, j, n;
 
@@ -946,39 +933,38 @@ find_matching_predicate_in_rest_chains (pred_info pred,
       pred_chain one_chain = preds[i];
       n = one_chain.length ();
       for (j = 0; j < n; j++)
-        {
-          pred_info pred2 = one_chain[j];
-          /* Can relax the condition comparison to not
-             use address comparison. However, the most common
-             case is that multiple control dependent paths share
-             a common path prefix, so address comparison should
-             be ok.  */
-
-          if (operand_equal_p (pred2.pred_lhs, pred.pred_lhs, 0)
-              && operand_equal_p (pred2.pred_rhs, pred.pred_rhs, 0)
-              && pred2.invert == pred.invert)
-            {
-              found = true;
-              break;
-            }
-        }
+	{
+	  pred_info pred2 = one_chain[j];
+	  /* Can relax the condition comparison to not
+	     use address comparison.  However, the most common
+	     case is that multiple control dependent paths share
+	     a common path prefix, so address comparison should
+	     be ok.  */
+
+	  if (operand_equal_p (pred2.pred_lhs, pred.pred_lhs, 0)
+	      && operand_equal_p (pred2.pred_rhs, pred.pred_rhs, 0)
+	      && pred2.invert == pred.invert)
+	    {
+	      found = true;
+	      break;
+	    }
+	}
       if (!found)
-        return false;
+	return false;
     }
   return true;
 }
 
 /* Forward declaration.  */
-static bool
-is_use_properly_guarded (gimple *use_stmt,
-                         basic_block use_bb,
-                         gphi *phi,
-                         unsigned uninit_opnds,
-			 pred_chain_union *def_preds,
-                         hash_set<gphi *> *visited_phis);
-
-/* Returns true if all uninitialized opnds are pruned. Returns false
-   otherwise. PHI is the phi node with uninitialized operands,
+static bool is_use_properly_guarded (gimple *use_stmt,
+				     basic_block use_bb,
+				     gphi *phi,
+				     unsigned uninit_opnds,
+				     pred_chain_union *def_preds,
+				     hash_set<gphi *> *visited_phis);
+
+/* Returns true if all uninitialized opnds are pruned.  Returns false
+   otherwise.  PHI is the phi node with uninitialized operands,
    UNINIT_OPNDS is the bitmap of the uninitialize operand positions,
    FLAG_DEF is the statement defining the flag guarding the use of the
    PHI output, BOUNDARY_CST is the const value used in the predicate
@@ -990,7 +976,7 @@ is_use_properly_guarded (gimple *use_stmt,
    Example scenario:
 
    BB1:
-   flag_1 = phi <0, 1>                  // (1)
+   flag_1 = phi <0, 1>		  // (1)
    var_1  = phi <undef, some_val>
 
 
@@ -1001,13 +987,14 @@ is_use_properly_guarded (gimple *use_stmt,
       goto BB3;
 
    BB3:
-   use of var_2                         // (3)
+   use of var_2			 // (3)
 
    Because some flag arg in (1) is not constant, if we do not look into the
    flag phis recursively, it is conservatively treated as unknown and var_1
-   is thought to be flowed into use at (3). Since var_1 is potentially uninitialized
-   a false warning will be emitted. Checking recursively into (1), the compiler can
-   find out that only some_val (which is defined) can flow into (3) which is OK.
+   is thought to be flowed into use at (3).  Since var_1 is potentially
+   uninitialized a false warning will be emitted.
+   Checking recursively into (1), the compiler can find out that only some_val
+   (which is defined) can flow into (3) which is OK.
 
 */
 
@@ -1027,89 +1014,87 @@ prune_uninit_phi_opnds_in_unrealizable_paths (gphi *phi,
       tree flag_arg;
 
       if (!MASK_TEST_BIT (uninit_opnds, i))
-        continue;
+	continue;
 
       flag_arg = gimple_phi_arg_def (flag_def, i);
       if (!is_gimple_constant (flag_arg))
-        {
-          gphi *flag_arg_def, *phi_arg_def;
-          tree phi_arg;
-          unsigned uninit_opnds_arg_phi;
-
-          if (TREE_CODE (flag_arg) != SSA_NAME)
-            return false;
-          flag_arg_def = dyn_cast <gphi *> (SSA_NAME_DEF_STMT (flag_arg));
+	{
+	  gphi *flag_arg_def, *phi_arg_def;
+	  tree phi_arg;
+	  unsigned uninit_opnds_arg_phi;
+
+	  if (TREE_CODE (flag_arg) != SSA_NAME)
+	    return false;
+	  flag_arg_def = dyn_cast<gphi *> (SSA_NAME_DEF_STMT (flag_arg));
 	  if (!flag_arg_def)
-            return false;
+	    return false;
 
-          phi_arg = gimple_phi_arg_def (phi, i);
-          if (TREE_CODE (phi_arg) != SSA_NAME)
-            return false;
+	  phi_arg = gimple_phi_arg_def (phi, i);
+	  if (TREE_CODE (phi_arg) != SSA_NAME)
+	    return false;
 
-          phi_arg_def = dyn_cast <gphi *> (SSA_NAME_DEF_STMT (phi_arg));
+	  phi_arg_def = dyn_cast<gphi *> (SSA_NAME_DEF_STMT (phi_arg));
 	  if (!phi_arg_def)
-            return false;
+	    return false;
 
-          if (gimple_bb (phi_arg_def) != gimple_bb (flag_arg_def))
-            return false;
+	  if (gimple_bb (phi_arg_def) != gimple_bb (flag_arg_def))
+	    return false;
 
-          if (!*visited_flag_phis)
-            *visited_flag_phis = BITMAP_ALLOC (NULL);
+	  if (!*visited_flag_phis)
+	    *visited_flag_phis = BITMAP_ALLOC (NULL);
 
-          if (bitmap_bit_p (*visited_flag_phis,
-                            SSA_NAME_VERSION (gimple_phi_result (flag_arg_def))))
-            return false;
+	  if (bitmap_bit_p (*visited_flag_phis,
+			    SSA_NAME_VERSION (
+			      gimple_phi_result (flag_arg_def))))
+	    return false;
 
-          bitmap_set_bit (*visited_flag_phis,
-                          SSA_NAME_VERSION (gimple_phi_result (flag_arg_def)));
+	  bitmap_set_bit (*visited_flag_phis,
+			  SSA_NAME_VERSION (gimple_phi_result (flag_arg_def)));
 
-          /* Now recursively prune the uninitialized phi args.  */
-          uninit_opnds_arg_phi = compute_uninit_opnds_pos (phi_arg_def);
-          if (!prune_uninit_phi_opnds_in_unrealizable_paths
-		 (phi_arg_def, uninit_opnds_arg_phi, flag_arg_def,
-		  boundary_cst, cmp_code, visited_phis, visited_flag_phis))
-            return false;
+	  /* Now recursively prune the uninitialized phi args.  */
+	  uninit_opnds_arg_phi = compute_uninit_opnds_pos (phi_arg_def);
+	  if (!prune_uninit_phi_opnds_in_unrealizable_paths
+	      (phi_arg_def, uninit_opnds_arg_phi, flag_arg_def, boundary_cst,
+	       cmp_code, visited_phis, visited_flag_phis))
+	    return false;
 
-          bitmap_clear_bit (*visited_flag_phis,
-                            SSA_NAME_VERSION (gimple_phi_result (flag_arg_def)));
-          continue;
-        }
+	  bitmap_clear_bit (*visited_flag_phis,
+			    SSA_NAME_VERSION (
+			      gimple_phi_result (flag_arg_def)));
+	  continue;
+	}
 
       /* Now check if the constant is in the guarded range.  */
       if (is_value_included_in (flag_arg, boundary_cst, cmp_code))
-        {
-          tree opnd;
+	{
+	  tree opnd;
 	  gimple *opnd_def;
 
-          /* Now that we know that this undefined edge is not
-             pruned. If the operand is defined by another phi,
-             we can further prune the incoming edges of that
-             phi by checking the predicates of this operands.  */
-
-          opnd = gimple_phi_arg_def (phi, i);
-          opnd_def = SSA_NAME_DEF_STMT (opnd);
-          if (gphi *opnd_def_phi = dyn_cast <gphi *> (opnd_def))
-            {
-              edge opnd_edge;
-              unsigned uninit_opnds2
-                  = compute_uninit_opnds_pos (opnd_def_phi);
-              pred_chain_union def_preds = vNULL;
-              bool ok;
-              gcc_assert (!MASK_EMPTY (uninit_opnds2));
-              opnd_edge = gimple_phi_arg_edge (phi, i);
-              ok = is_use_properly_guarded (phi,
-					    opnd_edge->src,
-					    opnd_def_phi,
-					    uninit_opnds2,
-					    &def_preds,
+	  /* Now that we know that this undefined edge is not
+	     pruned.  If the operand is defined by another phi,
+	     we can further prune the incoming edges of that
+	     phi by checking the predicates of this operands.  */
+
+	  opnd = gimple_phi_arg_def (phi, i);
+	  opnd_def = SSA_NAME_DEF_STMT (opnd);
+	  if (gphi *opnd_def_phi = dyn_cast<gphi *> (opnd_def))
+	    {
+	      edge opnd_edge;
+	      unsigned uninit_opnds2 = compute_uninit_opnds_pos (opnd_def_phi);
+	      pred_chain_union def_preds = vNULL;
+	      bool ok;
+	      gcc_assert (!MASK_EMPTY (uninit_opnds2));
+	      opnd_edge = gimple_phi_arg_edge (phi, i);
+	      ok = is_use_properly_guarded (phi, opnd_edge->src, opnd_def_phi,
+					    uninit_opnds2, &def_preds,
 					    visited_phis);
 	      destroy_predicate_vecs (&def_preds);
 	      if (!ok)
 		return false;
-            }
-          else
-            return false;
-        }
+	    }
+	  else
+	    return false;
+	}
     }
 
   return true;
@@ -1119,50 +1104,50 @@ prune_uninit_phi_opnds_in_unrealizable_paths (gphi *phi,
    of the use is not overlapping with that of the uninit paths.
    The most common senario of guarded use is in Example 1:
      Example 1:
-           if (some_cond)
-           {
-              x = ...;
-              flag = true;
-           }
+	   if (some_cond)
+	   {
+	      x = ...;
+	      flag = true;
+	   }
 
-            ... some code ...
+	    ... some code ...
 
-           if (flag)
-              use (x);
+	   if (flag)
+	      use (x);
 
      The real world examples are usually more complicated, but similar
      and usually result from inlining:
 
-         bool init_func (int * x)
-         {
-             if (some_cond)
-                return false;
-             *x  =  ..
-             return true;
-         }
+	 bool init_func (int * x)
+	 {
+	     if (some_cond)
+		return false;
+	     *x  =  ..
+	     return true;
+	 }
 
-         void foo(..)
-         {
-             int x;
+	 void foo (..)
+	 {
+	     int x;
 
-             if (!init_func(&x))
-                return;
+	     if (!init_func (&x))
+		return;
 
-             .. some_code ...
-             use (x);
-         }
+	     .. some_code ...
+	     use (x);
+	 }
 
      Another possible use scenario is in the following trivial example:
 
      Example 2:
-          if (n > 0)
-             x = 1;
-          ...
-          if (n > 0)
-            {
-              if (m < 2)
-                 .. = x;
-            }
+	  if (n > 0)
+	     x = 1;
+	  ...
+	  if (n > 0)
+	    {
+	      if (m < 2)
+		 .. = x;
+	    }
 
      Predicate analysis needs to compute the composite predicate:
 
@@ -1173,11 +1158,11 @@ prune_uninit_phi_opnds_in_unrealizable_paths (gphi *phi,
        bb and is dominating the operand def.)
 
        and check overlapping:
-          (n > 0) .AND. (m < 2) .AND. (.NOT. (n > 0))
-        <==> false
+	  (n > 0) .AND. (m < 2) .AND. (.NOT. (n > 0))
+	<==> false
 
      This implementation provides framework that can handle
-     scenarios. (Note that many simple cases are handled properly
+     scenarios.  (Note that many simple cases are handled properly
      without the predicate analysis -- this is due to jump threading
      transformation which eliminates the merge point thus makes
      path sensitive analysis unnecessary.)
@@ -1185,18 +1170,17 @@ prune_uninit_phi_opnds_in_unrealizable_paths (gphi *phi,
      NUM_PREDS is the number is the number predicate chains, PREDS is
      the array of chains, PHI is the phi node whose incoming (undefined)
      paths need to be pruned, and UNINIT_OPNDS is the bitmap holding
-     uninit operand positions. VISITED_PHIS is the pointer set of phi
+     uninit operand positions.  VISITED_PHIS is the pointer set of phi
      stmts being checked.  */
 
-
 static bool
 use_pred_not_overlap_with_undef_path_pred (pred_chain_union preds,
-				           gphi *phi, unsigned uninit_opnds,
+					   gphi *phi, unsigned uninit_opnds,
 					   hash_set<gphi *> *visited_phis)
 {
   unsigned int i, n;
   gimple *flag_def = 0;
-  tree  boundary_cst = 0;
+  tree boundary_cst = 0;
   enum tree_code cmp_code;
   bool swap_cond = false;
   bool invert = false;
@@ -1223,32 +1207,32 @@ use_pred_not_overlap_with_undef_path_pred (pred_chain_union preds,
       cmp_code = the_pred.cond_code;
 
       if (cond_lhs != NULL_TREE && TREE_CODE (cond_lhs) == SSA_NAME
-          && cond_rhs != NULL_TREE && is_gimple_constant (cond_rhs))
-        {
-          boundary_cst = cond_rhs;
-          flag = cond_lhs;
-        }
+	  && cond_rhs != NULL_TREE && is_gimple_constant (cond_rhs))
+	{
+	  boundary_cst = cond_rhs;
+	  flag = cond_lhs;
+	}
       else if (cond_rhs != NULL_TREE && TREE_CODE (cond_rhs) == SSA_NAME
-               && cond_lhs != NULL_TREE && is_gimple_constant (cond_lhs))
-        {
-          boundary_cst = cond_lhs;
-          flag = cond_rhs;
-          swap_cond = true;
-        }
+	       && cond_lhs != NULL_TREE && is_gimple_constant (cond_lhs))
+	{
+	  boundary_cst = cond_lhs;
+	  flag = cond_rhs;
+	  swap_cond = true;
+	}
 
       if (!flag)
-        continue;
+	continue;
 
       flag_def = SSA_NAME_DEF_STMT (flag);
 
       if (!flag_def)
-        continue;
+	continue;
 
       if ((gimple_code (flag_def) == GIMPLE_PHI)
-          && (gimple_bb (flag_def) == gimple_bb (phi))
-          && find_matching_predicate_in_rest_chains (the_pred, preds,
+	  && (gimple_bb (flag_def) == gimple_bb (phi))
+	  && find_matching_predicate_in_rest_chains (the_pred, preds,
 						     num_preds))
-        break;
+	break;
 
       flag_def = 0;
     }
@@ -1263,13 +1247,9 @@ use_pred_not_overlap_with_undef_path_pred (pred_chain_union preds,
   if (cmp_code == ERROR_MARK)
     return false;
 
-  all_pruned = prune_uninit_phi_opnds_in_unrealizable_paths (phi,
-                                                             uninit_opnds,
-                                                             as_a <gphi *> (flag_def),
-                                                             boundary_cst,
-                                                             cmp_code,
-                                                             visited_phis,
-                                                             &visited_flag_phis);
+  all_pruned = prune_uninit_phi_opnds_in_unrealizable_paths
+    (phi, uninit_opnds, as_a<gphi *> (flag_def), boundary_cst, cmp_code,
+     visited_phis, &visited_flag_phis);
 
   if (visited_flag_phis)
     BITMAP_FREE (visited_flag_phis);
@@ -1278,7 +1258,7 @@ use_pred_not_overlap_with_undef_path_pred (pred_chain_union preds,
 }
 
 /* The helper function returns true if two predicates X1 and X2
-   are equivalent. It assumes the expressions have already
+   are equivalent.  It assumes the expressions have already
    properly re-associated.  */
 
 static inline bool
@@ -1305,13 +1285,13 @@ static inline bool
 is_neq_relop_p (pred_info pred)
 {
 
-  return (pred.cond_code == NE_EXPR && !pred.invert) 
-          || (pred.cond_code == EQ_EXPR && pred.invert);
+  return (pred.cond_code == NE_EXPR && !pred.invert)
+	 || (pred.cond_code == EQ_EXPR && pred.invert);
 }
 
 /* Returns true if pred is of the form X != 0.  */
 
-static inline bool 
+static inline bool
 is_neq_zero_form_p (pred_info pred)
 {
   if (!is_neq_relop_p (pred) || !integer_zerop (pred.pred_rhs)
@@ -1333,7 +1313,7 @@ pred_expr_equal_p (pred_info x1, tree x2)
 }
 
 /* Returns true of the domain of single predicate expression
-   EXPR1 is a subset of that of EXPR2. Returns false if it
+   EXPR1 is a subset of that of EXPR2.  Returns false if it
    can not be proved.  */
 
 static bool
@@ -1358,8 +1338,7 @@ is_pred_expr_subset_of (pred_info expr1, pred_info expr2)
   if (expr2.invert)
     code2 = invert_tree_comparison (code2, false);
 
-  if ((code1 == EQ_EXPR || code1 == BIT_AND_EXPR)
-      && code2 == BIT_AND_EXPR)
+  if ((code1 == EQ_EXPR || code1 == BIT_AND_EXPR) && code2 == BIT_AND_EXPR)
     return wi::eq_p (expr1.pred_rhs,
 		     wi::bit_and (expr1.pred_rhs, expr2.pred_rhs));
 
@@ -1373,11 +1352,10 @@ is_pred_expr_subset_of (pred_info expr1, pred_info expr2)
 }
 
 /* Returns true if the domain of PRED1 is a subset
-   of that of PRED2. Returns false if it can not be proved so.  */
+   of that of PRED2.  Returns false if it can not be proved so.  */
 
 static bool
-is_pred_chain_subset_of (pred_chain pred1,
-                         pred_chain pred2)
+is_pred_chain_subset_of (pred_chain pred1, pred_chain pred2)
 {
   size_t np1, np2, i1, i2;
 
@@ -1389,23 +1367,23 @@ is_pred_chain_subset_of (pred_chain pred1,
       bool found = false;
       pred_info info2 = pred2[i2];
       for (i1 = 0; i1 < np1; i1++)
-        {
-          pred_info info1 = pred1[i1];
-          if (is_pred_expr_subset_of (info1, info2))
-            {
-              found = true;
-              break;
-            }
-        }
+	{
+	  pred_info info1 = pred1[i1];
+	  if (is_pred_expr_subset_of (info1, info2))
+	    {
+	      found = true;
+	      break;
+	    }
+	}
       if (!found)
-        return false;
+	return false;
     }
   return true;
 }
 
 /* Returns true if the domain defined by
    one pred chain ONE_PRED is a subset of the domain
-   of *PREDS. It returns false if ONE_PRED's domain is
+   of *PREDS.  It returns false if ONE_PRED's domain is
    not a subset of any of the sub-domains of PREDS
    (corresponding to each individual chains in it), even
    though it may be still be a subset of whole domain
@@ -1421,7 +1399,7 @@ is_included_in (pred_chain one_pred, pred_chain_union preds)
   for (i = 0; i < n; i++)
     {
       if (is_pred_chain_subset_of (one_pred, preds[i]))
-        return true;
+	return true;
     }
 
   return false;
@@ -1429,15 +1407,15 @@ is_included_in (pred_chain one_pred, pred_chain_union preds)
 
 /* Compares two predicate sets PREDS1 and PREDS2 and returns
    true if the domain defined by PREDS1 is a superset
-   of PREDS2's domain. N1 and N2 are array sizes of PREDS1 and
-   PREDS2 respectively. The implementation chooses not to build
+   of PREDS2's domain.  N1 and N2 are array sizes of PREDS1 and
+   PREDS2 respectively.  The implementation chooses not to build
    generic trees (and relying on the folding capability of the
    compiler), but instead performs brute force comparison of
    individual predicate chains (won't be a compile time problem
-   as the chains are pretty short). When the function returns
+   as the chains are pretty short).  When the function returns
    false, it does not necessarily mean *PREDS1 is not a superset
    of *PREDS2, but mean it may not be so since the analysis can
-   not prove it. In such cases, false warnings may still be
+   not prove it.  In such cases, false warnings may still be
    emitted.  */
 
 static bool
@@ -1452,7 +1430,7 @@ is_superset_of (pred_chain_union preds1, pred_chain_union preds2)
     {
       one_pred_chain = preds2[i];
       if (!is_included_in (one_pred_chain, preds1))
-        return false;
+	return false;
     }
 
   return true;
@@ -1464,8 +1442,8 @@ static inline bool
 is_and_or_or_p (enum tree_code tc, tree type)
 {
   return (tc == BIT_IOR_EXPR
-          || (tc == BIT_AND_EXPR
-              && (type == 0 || TREE_CODE (type) == BOOLEAN_TYPE)));
+	  || (tc == BIT_AND_EXPR
+	      && (type == 0 || TREE_CODE (type) == BOOLEAN_TYPE)));
 }
 
 /* Returns true if X1 is the negate of X2.  */
@@ -1477,7 +1455,7 @@ pred_neg_p (pred_info x1, pred_info x2)
   if (!operand_equal_p (x1.pred_lhs, x2.pred_lhs, 0)
       || !operand_equal_p (x1.pred_rhs, x2.pred_rhs, 0))
     return false;
-      
+
   c1 = x1.cond_code;
   if (x1.invert == x2.invert)
     c2 = invert_tree_comparison (x2.cond_code, false);
@@ -1493,7 +1471,7 @@ pred_neg_p (pred_info x1, pred_info x2)
    4) ((x IAND y) != 0) || (x != 0 AND y != 0)) is equivalent to
       (x != 0 AND y != 0)
    5) (X AND Y) OR (!X AND Z) OR (!Y AND Z) is equivalent to
-      (X AND Y) OR Z 
+      (X AND Y) OR Z
 
    PREDS is the predicate chains, and N is the number of chains.  */
 
@@ -1514,50 +1492,50 @@ simplify_pred (pred_chain *one_chain)
       pred_info *a_pred = &(*one_chain)[i];
 
       if (!a_pred->pred_lhs)
-        continue;
+	continue;
       if (!is_neq_zero_form_p (*a_pred))
-        continue;
+	continue;
 
       gimple *def_stmt = SSA_NAME_DEF_STMT (a_pred->pred_lhs);
       if (gimple_code (def_stmt) != GIMPLE_ASSIGN)
-        continue;
+	continue;
       if (gimple_assign_rhs_code (def_stmt) == BIT_IOR_EXPR)
-        {
-          for (j = 0; j < n; j++)
-            {
-              pred_info *b_pred = &(*one_chain)[j];
-
-              if (!b_pred->pred_lhs)
-                continue;
-              if (!is_neq_zero_form_p (*b_pred))
-                continue;
-
-              if (pred_expr_equal_p (*b_pred, gimple_assign_rhs1 (def_stmt))
-                  || pred_expr_equal_p (*b_pred, gimple_assign_rhs2 (def_stmt)))
-                 {
-                   /* Mark a_pred for removal.  */
-                   a_pred->pred_lhs = NULL;
-                   a_pred->pred_rhs = NULL;
-                   simplified = true;
-                   break;
-                 }
-            }
-        }
+	{
+	  for (j = 0; j < n; j++)
+	    {
+	      pred_info *b_pred = &(*one_chain)[j];
+
+	      if (!b_pred->pred_lhs)
+		continue;
+	      if (!is_neq_zero_form_p (*b_pred))
+		continue;
+
+	      if (pred_expr_equal_p (*b_pred, gimple_assign_rhs1 (def_stmt))
+		  || pred_expr_equal_p (*b_pred, gimple_assign_rhs2 (def_stmt)))
+		{
+		  /* Mark a_pred for removal.  */
+		  a_pred->pred_lhs = NULL;
+		  a_pred->pred_rhs = NULL;
+		  simplified = true;
+		  break;
+		}
+	    }
+	}
     }
 
   if (!simplified)
-     return;
+    return;
 
   for (i = 0; i < n; i++)
     {
       pred_info *a_pred = &(*one_chain)[i];
       if (!a_pred->pred_lhs)
-        continue;
+	continue;
       s_chain.safe_push (*a_pred);
     }
 
-   one_chain->release ();
-   *one_chain = s_chain;
+  one_chain->release ();
+  *one_chain = s_chain;
 }
 
 /* The helper function implements the rule 2 for the
@@ -1572,7 +1550,7 @@ simplify_preds_2 (pred_chain_union *preds)
   bool simplified = false;
   pred_chain_union s_preds = vNULL;
 
-  /* (X AND Y) OR (!X AND Y) is equivalent to Y.  
+  /* (X AND Y) OR (!X AND Y) is equivalent to Y.
      (X AND Y) OR (X AND !Y) is equivalent to X.  */
 
   n = preds->length ();
@@ -1582,55 +1560,55 @@ simplify_preds_2 (pred_chain_union *preds)
       pred_chain *a_chain = &(*preds)[i];
 
       if (a_chain->length () != 2)
-        continue;
+	continue;
 
       x = (*a_chain)[0];
       y = (*a_chain)[1];
 
       for (j = 0; j < n; j++)
-        {
-          pred_chain *b_chain;
-          pred_info x2, y2;
-
-          if (j == i)
-            continue;
-
-          b_chain = &(*preds)[j];
-          if (b_chain->length () != 2)
-            continue;
-
-          x2 = (*b_chain)[0];
-          y2 = (*b_chain)[1];
-
-          if (pred_equal_p (x, x2) && pred_neg_p (y, y2))
-            {
-              /* Kill a_chain.  */
-              a_chain->release ();
-              b_chain->release ();
-              b_chain->safe_push (x);
-              simplified = true;
-              break;
-            }
-          if (pred_neg_p (x, x2) && pred_equal_p (y, y2))
-            {
-              /* Kill a_chain.  */
-              a_chain->release ();
-              b_chain->release ();
-              b_chain->safe_push (y);
-              simplified = true;
-              break;
-            }
-        }
+	{
+	  pred_chain *b_chain;
+	  pred_info x2, y2;
+
+	  if (j == i)
+	    continue;
+
+	  b_chain = &(*preds)[j];
+	  if (b_chain->length () != 2)
+	    continue;
+
+	  x2 = (*b_chain)[0];
+	  y2 = (*b_chain)[1];
+
+	  if (pred_equal_p (x, x2) && pred_neg_p (y, y2))
+	    {
+	      /* Kill a_chain.  */
+	      a_chain->release ();
+	      b_chain->release ();
+	      b_chain->safe_push (x);
+	      simplified = true;
+	      break;
+	    }
+	  if (pred_neg_p (x, x2) && pred_equal_p (y, y2))
+	    {
+	      /* Kill a_chain.  */
+	      a_chain->release ();
+	      b_chain->release ();
+	      b_chain->safe_push (y);
+	      simplified = true;
+	      break;
+	    }
+	}
     }
   /* Now clean up the chain.  */
   if (simplified)
     {
       for (i = 0; i < n; i++)
-        {
-          if ((*preds)[i].is_empty ())
-            continue;
-          s_preds.safe_push ((*preds)[i]);
-        }
+	{
+	  if ((*preds)[i].is_empty ())
+	    continue;
+	  s_preds.safe_push ((*preds)[i]);
+	}
       preds->release ();
       (*preds) = s_preds;
       s_preds = vNULL;
@@ -1663,34 +1641,34 @@ simplify_preds_3 (pred_chain_union *preds)
       pred_chain *a_chain = &(*preds)[i];
 
       if (a_chain->length () != 1)
-        continue;
+	continue;
 
       x = (*a_chain)[0];
 
       for (j = 0; j < n; j++)
-        {
-          pred_chain *b_chain;
-          pred_info x2;
-          size_t k;
-
-          if (j == i)
-            continue;
-
-          b_chain = &(*preds)[j];
-          if (b_chain->length () < 2)
-            continue;
-
-          for (k = 0; k < b_chain->length (); k++)
-            {
-              x2 = (*b_chain)[k];
-              if (pred_neg_p (x, x2))
-                {
-                  b_chain->unordered_remove (k);
-                  simplified = true;
-                  break;
-                }
-            }
-        }
+	{
+	  pred_chain *b_chain;
+	  pred_info x2;
+	  size_t k;
+
+	  if (j == i)
+	    continue;
+
+	  b_chain = &(*preds)[j];
+	  if (b_chain->length () < 2)
+	    continue;
+
+	  for (k = 0; k < b_chain->length (); k++)
+	    {
+	      x2 = (*b_chain)[k];
+	      if (pred_neg_p (x, x2))
+		{
+		  b_chain->unordered_remove (k);
+		  simplified = true;
+		  break;
+		}
+	    }
+	}
     }
   return simplified;
 }
@@ -1716,59 +1694,58 @@ simplify_preds_4 (pred_chain_union *preds)
       pred_chain *a_chain = &(*preds)[i];
 
       if (a_chain->length () != 1)
-        continue;
+	continue;
 
       z = (*a_chain)[0];
 
       if (!is_neq_zero_form_p (z))
-        continue;
+	continue;
 
       def_stmt = SSA_NAME_DEF_STMT (z.pred_lhs);
       if (gimple_code (def_stmt) != GIMPLE_ASSIGN)
-        continue;
+	continue;
 
       if (gimple_assign_rhs_code (def_stmt) != BIT_AND_EXPR)
-        continue;
+	continue;
 
       for (j = 0; j < n; j++)
-        {
-          pred_chain *b_chain;
-          pred_info x2, y2;
-
-          if (j == i)
-            continue;
-
-          b_chain = &(*preds)[j];
-          if (b_chain->length () != 2)
-            continue;
-
-          x2 = (*b_chain)[0];
-          y2 = (*b_chain)[1];
-          if (!is_neq_zero_form_p (x2)
-              || !is_neq_zero_form_p (y2))
-            continue;
-
-          if ((pred_expr_equal_p (x2, gimple_assign_rhs1 (def_stmt))
-               && pred_expr_equal_p (y2, gimple_assign_rhs2 (def_stmt)))
-              || (pred_expr_equal_p (x2, gimple_assign_rhs2 (def_stmt))
-                  && pred_expr_equal_p (y2, gimple_assign_rhs1 (def_stmt))))
-            {
-              /* Kill a_chain.  */
-              a_chain->release ();
-              simplified = true;
-              break;
-            }
-        }
+	{
+	  pred_chain *b_chain;
+	  pred_info x2, y2;
+
+	  if (j == i)
+	    continue;
+
+	  b_chain = &(*preds)[j];
+	  if (b_chain->length () != 2)
+	    continue;
+
+	  x2 = (*b_chain)[0];
+	  y2 = (*b_chain)[1];
+	  if (!is_neq_zero_form_p (x2) || !is_neq_zero_form_p (y2))
+	    continue;
+
+	  if ((pred_expr_equal_p (x2, gimple_assign_rhs1 (def_stmt))
+	       && pred_expr_equal_p (y2, gimple_assign_rhs2 (def_stmt)))
+	      || (pred_expr_equal_p (x2, gimple_assign_rhs2 (def_stmt))
+		  && pred_expr_equal_p (y2, gimple_assign_rhs1 (def_stmt))))
+	    {
+	      /* Kill a_chain.  */
+	      a_chain->release ();
+	      simplified = true;
+	      break;
+	    }
+	}
     }
   /* Now clean up the chain.  */
   if (simplified)
     {
       for (i = 0; i < n; i++)
-        {
-          if ((*preds)[i].is_empty ())
-            continue;
-          s_preds.safe_push ((*preds)[i]);
-        }
+	{
+	  if ((*preds)[i].is_empty ())
+	    continue;
+	  s_preds.safe_push ((*preds)[i]);
+	}
 
       destroy_predicate_vecs (preds);
       (*preds) = s_preds;
@@ -1778,7 +1755,6 @@ simplify_preds_4 (pred_chain_union *preds)
   return simplified;
 }
 
-
 /* This function simplifies predicates in PREDS.  */
 
 static void
@@ -1804,24 +1780,24 @@ simplify_preds (pred_chain_union *preds, gimple *use_or_def, bool is_use)
     {
       changed = false;
       if (simplify_preds_2 (preds))
-        changed = true;
+	changed = true;
 
       /* Now iteratively simplify X OR (!X AND Z ..)
        into X OR (Z ...).  */
       if (simplify_preds_3 (preds))
-        changed = true;
+	changed = true;
 
       if (simplify_preds_4 (preds))
-        changed = true;
-
-    } while (changed);
+	changed = true;
+    }
+  while (changed);
 
   return;
 }
 
 /* This is a helper function which attempts to normalize predicate chains
-  by following UD chains. It basically builds up a big tree of either IOR
-  operations or AND operations, and convert the IOR tree into a 
+  by following UD chains.  It basically builds up a big tree of either IOR
+  operations or AND operations, and convert the IOR tree into a
   pred_chain_union or BIT_AND tree into a pred_chain.
   Example:
 
@@ -1846,7 +1822,7 @@ simplify_preds (pred_chain_union *preds, gimple *use_or_def, bool is_use)
 
  then _t != 0 will be normalized into a pred_chain:
    (_2 RELOP1 _1) AND (_5 RELOP2 _4) AND (_8 RELOP3 _7) AND (_0 != 0)
-   
+
   */
 
 /* This is a helper function that stores a PRED into NORM_PREDS.  */
@@ -1864,7 +1840,7 @@ push_pred (pred_chain_union *norm_preds, pred_info pred)
 
 inline static void
 push_to_worklist (tree op, vec<pred_info, va_heap, vl_ptr> *work_list,
-                  hash_set<tree> *mark_set)
+		  hash_set<tree> *mark_set)
 {
   if (mark_set->contains (op))
     return;
@@ -1893,7 +1869,7 @@ get_pred_info_from_cmp (gimple *cmp_assign)
 }
 
 /* Returns true if the PHI is a degenerated phi with
-   all args with the same value (relop). In that case, *PRED
+   all args with the same value (relop).  In that case, *PRED
    will be updated to that value.  */
 
 static bool
@@ -1913,8 +1889,7 @@ is_degenerated_phi (gimple *phi, pred_info *pred_p)
   def0 = SSA_NAME_DEF_STMT (op0);
   if (gimple_code (def0) != GIMPLE_ASSIGN)
     return false;
-  if (TREE_CODE_CLASS (gimple_assign_rhs_code (def0))
-      != tcc_comparison)
+  if (TREE_CODE_CLASS (gimple_assign_rhs_code (def0)) != tcc_comparison)
     return false;
   pred0 = get_pred_info_from_cmp (def0);
 
@@ -1925,76 +1900,74 @@ is_degenerated_phi (gimple *phi, pred_info *pred_p)
       tree op = gimple_phi_arg_def (phi, i);
 
       if (TREE_CODE (op) != SSA_NAME)
-        return false;
+	return false;
 
       def = SSA_NAME_DEF_STMT (op);
       if (gimple_code (def) != GIMPLE_ASSIGN)
-        return false;
-      if (TREE_CODE_CLASS (gimple_assign_rhs_code (def))
-          != tcc_comparison)
-        return false;
+	return false;
+      if (TREE_CODE_CLASS (gimple_assign_rhs_code (def)) != tcc_comparison)
+	return false;
       pred = get_pred_info_from_cmp (def);
       if (!pred_equal_p (pred, pred0))
-        return false;
+	return false;
     }
 
   *pred_p = pred0;
   return true;
 }
 
-/* Normalize one predicate PRED  
+/* Normalize one predicate PRED
    1) if PRED can no longer be normlized, put it into NORM_PREDS.
    2) otherwise if PRED is of the form x != 0, follow x's definition
       and put normalized predicates into WORK_LIST.  */
- 
+
 static void
-normalize_one_pred_1 (pred_chain_union *norm_preds, 
-                      pred_chain *norm_chain,
-                      pred_info pred,
-                      enum tree_code and_or_code,
-                      vec<pred_info, va_heap, vl_ptr> *work_list,
+normalize_one_pred_1 (pred_chain_union *norm_preds,
+		      pred_chain *norm_chain,
+		      pred_info pred,
+		      enum tree_code and_or_code,
+		      vec<pred_info, va_heap, vl_ptr> *work_list,
 		      hash_set<tree> *mark_set)
 {
   if (!is_neq_zero_form_p (pred))
     {
       if (and_or_code == BIT_IOR_EXPR)
-        push_pred (norm_preds, pred);
+	push_pred (norm_preds, pred);
       else
-        norm_chain->safe_push (pred);
+	norm_chain->safe_push (pred);
       return;
     }
 
   gimple *def_stmt = SSA_NAME_DEF_STMT (pred.pred_lhs);
- 
+
   if (gimple_code (def_stmt) == GIMPLE_PHI
       && is_degenerated_phi (def_stmt, &pred))
     work_list->safe_push (pred);
-  else if (gimple_code (def_stmt) == GIMPLE_PHI
-           && and_or_code == BIT_IOR_EXPR)
+  else if (gimple_code (def_stmt) == GIMPLE_PHI && and_or_code == BIT_IOR_EXPR)
     {
       int i, n;
       n = gimple_phi_num_args (def_stmt);
 
-      /* If we see non zero constant, we should punt. The predicate
+      /* If we see non zero constant, we should punt.  The predicate
        * should be one guarding the phi edge.  */
       for (i = 0; i < n; ++i)
-        {
-          tree op = gimple_phi_arg_def (def_stmt, i);
-          if (TREE_CODE (op) == INTEGER_CST && !integer_zerop (op))
-            {
-              push_pred (norm_preds, pred);
-              return;
-            }
-        }
+	{
+	  tree op = gimple_phi_arg_def (def_stmt, i);
+	  if (TREE_CODE (op) == INTEGER_CST && !integer_zerop (op))
+	    {
+	      push_pred (norm_preds, pred);
+	      return;
+	    }
+	}
 
       for (i = 0; i < n; ++i)
-        {
-          tree op = gimple_phi_arg_def (def_stmt, i);
-          if (integer_zerop (op))
-            continue;
+	{
+	  tree op = gimple_phi_arg_def (def_stmt, i);
+	  if (integer_zerop (op))
+	    continue;
 
-          push_to_worklist (op, work_list, mark_set);
-        }
+	  push_to_worklist (op, work_list, mark_set);
+	}
     }
   else if (gimple_code (def_stmt) != GIMPLE_ASSIGN)
     {
@@ -2046,8 +2019,7 @@ normalize_one_pred_1 (pred_chain_union *norm_preds,
 /* Normalize PRED and store the normalized predicates into NORM_PREDS.  */
 
 static void
-normalize_one_pred (pred_chain_union *norm_preds,
-                    pred_info pred)
+normalize_one_pred (pred_chain_union *norm_preds, pred_info pred)
 {
   vec<pred_info, va_heap, vl_ptr> work_list = vNULL;
   enum tree_code and_or_code = ERROR_MARK;
@@ -2062,17 +2034,15 @@ normalize_one_pred (pred_chain_union *norm_preds,
   gimple *def_stmt = SSA_NAME_DEF_STMT (pred.pred_lhs);
   if (gimple_code (def_stmt) == GIMPLE_ASSIGN)
     and_or_code = gimple_assign_rhs_code (def_stmt);
-  if (and_or_code != BIT_IOR_EXPR
-      && and_or_code != BIT_AND_EXPR)
+  if (and_or_code != BIT_IOR_EXPR && and_or_code != BIT_AND_EXPR)
     {
-      if (TREE_CODE_CLASS (and_or_code)
-          == tcc_comparison)
-        {
-          pred_info n_pred = get_pred_info_from_cmp (def_stmt);
-          push_pred (norm_preds, n_pred);
-        } 
-       else
-          push_pred (norm_preds, pred);
+      if (TREE_CODE_CLASS (and_or_code) == tcc_comparison)
+	{
+	  pred_info n_pred = get_pred_info_from_cmp (def_stmt);
+	  push_pred (norm_preds, n_pred);
+	}
+      else
+	push_pred (norm_preds, pred);
       return;
     }
 
@@ -2082,8 +2052,8 @@ normalize_one_pred (pred_chain_union *norm_preds,
   while (!work_list.is_empty ())
     {
       pred_info a_pred = work_list.pop ();
-      normalize_one_pred_1 (norm_preds, &norm_chain, a_pred,
-                            and_or_code, &work_list, &mark_set);
+      normalize_one_pred_1 (norm_preds, &norm_chain, a_pred, and_or_code,
+			    &work_list, &mark_set);
     }
   if (and_or_code == BIT_AND_EXPR)
     norm_preds->safe_push (norm_chain);
@@ -2092,8 +2062,7 @@ normalize_one_pred (pred_chain_union *norm_preds,
 }
 
 static void
-normalize_one_pred_chain (pred_chain_union *norm_preds,
-                          pred_chain one_chain)
+normalize_one_pred_chain (pred_chain_union *norm_preds, pred_chain one_chain)
 {
   vec<pred_info, va_heap, vl_ptr> work_list = vNULL;
   hash_set<tree> mark_set;
@@ -2109,8 +2078,8 @@ normalize_one_pred_chain (pred_chain_union *norm_preds,
   while (!work_list.is_empty ())
     {
       pred_info a_pred = work_list.pop ();
-      normalize_one_pred_1 (0, &norm_chain, a_pred,
-                            BIT_AND_EXPR, &work_list, &mark_set);
+      normalize_one_pred_1 (0, &norm_chain, a_pred, BIT_AND_EXPR, &work_list,
+			    &mark_set);
     }
 
   norm_preds->safe_push (norm_chain);
@@ -2135,37 +2104,37 @@ normalize_preds (pred_chain_union preds, gimple *use_or_def, bool is_use)
   for (i = 0; i < n; i++)
     {
       if (preds[i].length () != 1)
-        normalize_one_pred_chain (&norm_preds, preds[i]);
+	normalize_one_pred_chain (&norm_preds, preds[i]);
       else
-        {
-          normalize_one_pred (&norm_preds, preds[i][0]);
-          preds[i].release ();
-        }
+	{
+	  normalize_one_pred (&norm_preds, preds[i][0]);
+	  preds[i].release ();
+	}
     }
 
   if (dump_file)
     {
       fprintf (dump_file, "[AFTER NORMALIZATION -- ");
-      dump_predicates (use_or_def, norm_preds, is_use ? "[USE]:\n" : "[DEF]:\n");
+      dump_predicates (use_or_def, norm_preds,
+		       is_use ? "[USE]:\n" : "[DEF]:\n");
     }
 
   destroy_predicate_vecs (&preds);
   return norm_preds;
 }
 
-
 /* Computes the predicates that guard the use and checks
    if the incoming paths that have empty (or possibly
-   empty) definition can be pruned/filtered. The function returns
+   empty) definition can be pruned/filtered.  The function returns
    true if it can be determined that the use of PHI's def in
    USE_STMT is guarded with a predicate set not overlapping with
    predicate sets of all runtime paths that do not have a definition.
 
-   Returns false if it is not or it can not be determined. USE_BB is
+   Returns false if it is not or it can not be determined.  USE_BB is
    the bb of the use (for phi operand use, the bb is not the bb of
    the phi stmt, but the src bb of the operand edge).
 
-   UNINIT_OPNDS is a bit vector. If an operand of PHI is uninitialized, the
+   UNINIT_OPNDS is a bit vector.  If an operand of PHI is uninitialized, the
    corresponding bit in the vector is 1.  VISITED_PHIS is a pointer
    set of phis being visited.
 
@@ -2177,11 +2146,11 @@ normalize_preds (pred_chain_union preds, gimple *use_or_def, bool is_use)
 
 static bool
 is_use_properly_guarded (gimple *use_stmt,
-                         basic_block use_bb,
-                         gphi *phi,
-                         unsigned uninit_opnds,
+			 basic_block use_bb,
+			 gphi *phi,
+			 unsigned uninit_opnds,
 			 pred_chain_union *def_preds,
-                         hash_set<gphi *> *visited_phis)
+			 hash_set<gphi *> *visited_phis)
 {
   basic_block phi_bb;
   pred_chain_union preds = vNULL;
@@ -2204,7 +2173,7 @@ is_use_properly_guarded (gimple *use_stmt,
       return false;
     }
 
-  /* Try to prune the dead incoming phi edges. */
+  /* Try to prune the dead incoming phi edges.  */
   is_properly_guarded
     = use_pred_not_overlap_with_undef_path_pred (preds, phi, uninit_opnds,
 						 visited_phis);
@@ -2240,16 +2209,16 @@ is_use_properly_guarded (gimple *use_stmt,
 
 /* Searches through all uses of a potentially
    uninitialized variable defined by PHI and returns a use
-   statement if the use is not properly guarded. It returns
-   NULL if all uses are guarded. UNINIT_OPNDS is a bitvector
-   holding the position(s) of uninit PHI operands. WORKLIST
+   statement if the use is not properly guarded.  It returns
+   NULL if all uses are guarded.  UNINIT_OPNDS is a bitvector
+   holding the position(s) of uninit PHI operands.  WORKLIST
    is the vector of candidate phis that may be updated by this
-   function. ADDED_TO_WORKLIST is the pointer set tracking
+   function.  ADDED_TO_WORKLIST is the pointer set tracking
    if the new phi is already in the worklist.  */
 
 static gimple *
 find_uninit_use (gphi *phi, unsigned uninit_opnds,
-                 vec<gphi *> *worklist,
+		 vec<gphi *> *worklist,
 		 hash_set<gphi *> *added_to_worklist)
 {
   tree phi_result;
@@ -2269,9 +2238,9 @@ find_uninit_use (gphi *phi, unsigned uninit_opnds,
       if (is_gimple_debug (use_stmt))
 	continue;
 
-      if (gphi *use_phi = dyn_cast <gphi *> (use_stmt))
-	use_bb = gimple_phi_arg_edge (use_phi,
-				      PHI_ARG_INDEX_FROM_USE (use_p))->src;
+      if (gphi *use_phi = dyn_cast<gphi *> (use_stmt))
+	use_bb
+	  = gimple_phi_arg_edge (use_phi, PHI_ARG_INDEX_FROM_USE (use_p))->src;
       else
 	use_bb = gimple_bb (use_stmt);
 
@@ -2281,10 +2250,10 @@ find_uninit_use (gphi *phi, unsigned uninit_opnds,
 	continue;
 
       if (dump_file && (dump_flags & TDF_DETAILS))
-        {
-          fprintf (dump_file, "[CHECK]: Found unguarded use: ");
-          print_gimple_stmt (dump_file, use_stmt, 0, 0);
-        }
+	{
+	  fprintf (dump_file, "[CHECK]: Found unguarded use: ");
+	  print_gimple_stmt (dump_file, use_stmt, 0, 0);
+	}
       /* Found one real use, return.  */
       if (gimple_code (use_stmt) != GIMPLE_PHI)
 	{
@@ -2293,18 +2262,18 @@ find_uninit_use (gphi *phi, unsigned uninit_opnds,
 	}
 
       /* Found a phi use that is not guarded,
-         add the phi to the worklist.  */
-      if (!added_to_worklist->add (as_a <gphi *> (use_stmt)))
-        {
-          if (dump_file && (dump_flags & TDF_DETAILS))
-            {
-              fprintf (dump_file, "[WORKLIST]: Update worklist with phi: ");
-              print_gimple_stmt (dump_file, use_stmt, 0, 0);
-            }
-
-          worklist->safe_push (as_a <gphi *> (use_stmt));
-          possibly_undefined_names->add (phi_result);
-        }
+	 add the phi to the worklist.  */
+      if (!added_to_worklist->add (as_a<gphi *> (use_stmt)))
+	{
+	  if (dump_file && (dump_flags & TDF_DETAILS))
+	    {
+	      fprintf (dump_file, "[WORKLIST]: Update worklist with phi: ");
+	      print_gimple_stmt (dump_file, use_stmt, 0, 0);
+	    }
+
+	  worklist->safe_push (as_a<gphi *> (use_stmt));
+	  possibly_undefined_names->add (phi_result);
+	}
     }
 
   destroy_predicate_vecs (&def_preds);
@@ -2313,15 +2282,15 @@ find_uninit_use (gphi *phi, unsigned uninit_opnds,
 
 /* Look for inputs to PHI that are SSA_NAMEs that have empty definitions
    and gives warning if there exists a runtime path from the entry to a
-   use of the PHI def that does not contain a definition. In other words,
-   the warning is on the real use. The more dead paths that can be pruned
-   by the compiler, the fewer false positives the warning is. WORKLIST
-   is a vector of candidate phis to be examined. ADDED_TO_WORKLIST is
+   use of the PHI def that does not contain a definition.  In other words,
+   the warning is on the real use.  The more dead paths that can be pruned
+   by the compiler, the fewer false positives the warning is.  WORKLIST
+   is a vector of candidate phis to be examined.  ADDED_TO_WORKLIST is
    a pointer set tracking if the new phi is added to the worklist or not.  */
 
 static void
 warn_uninitialized_phi (gphi *phi, vec<gphi *> *worklist,
-                        hash_set<gphi *> *added_to_worklist)
+			hash_set<gphi *> *added_to_worklist)
 {
   unsigned uninit_opnds;
   gimple *uninit_use_stmt = 0;
@@ -2335,7 +2304,7 @@ warn_uninitialized_phi (gphi *phi, vec<gphi *> *worklist,
 
   uninit_opnds = compute_uninit_opnds_pos (phi);
 
-  if  (MASK_EMPTY (uninit_opnds))
+  if (MASK_EMPTY (uninit_opnds))
     return;
 
   if (dump_file && (dump_flags & TDF_DETAILS))
@@ -2345,8 +2314,8 @@ warn_uninitialized_phi (gphi *phi, vec<gphi *> *worklist,
     }
 
   /* Now check if we have any use of the value without proper guard.  */
-  uninit_use_stmt = find_uninit_use (phi, uninit_opnds,
-                                     worklist, added_to_worklist);
+  uninit_use_stmt
+    = find_uninit_use (phi, uninit_opnds, worklist, added_to_worklist);
 
   /* All uses are properly guarded.  */
   if (!uninit_use_stmt)
@@ -2362,9 +2331,8 @@ warn_uninitialized_phi (gphi *phi, vec<gphi *> *worklist,
     loc = UNKNOWN_LOCATION;
   warn_uninit (OPT_Wmaybe_uninitialized, uninit_op, SSA_NAME_VAR (uninit_op),
 	       SSA_NAME_VAR (uninit_op),
-               "%qD may be used uninitialized in this function",
-               uninit_use_stmt, loc);
-
+	       "%qD may be used uninitialized in this function",
+	       uninit_use_stmt, loc);
 }
 
 static bool
@@ -2377,15 +2345,15 @@ namespace {
 
 const pass_data pass_data_late_warn_uninitialized =
 {
-  GIMPLE_PASS, /* type */
-  "uninit", /* name */
+  GIMPLE_PASS,   /* type */
+  "uninit",      /* name */
   OPTGROUP_NONE, /* optinfo_flags */
-  TV_NONE, /* tv_id */
-  PROP_ssa, /* properties_required */
-  0, /* properties_provided */
-  0, /* properties_destroyed */
-  0, /* todo_flags_start */
-  0, /* todo_flags_finish */
+  TV_NONE,       /* tv_id */
+  PROP_ssa,      /* properties_required */
+  0,		 /* properties_provided */
+  0,		 /* properties_destroyed */
+  0,		 /* todo_flags_start */
+  0,		 /* todo_flags_finish */
 };
 
 class pass_late_warn_uninitialized : public gimple_opt_pass
@@ -2393,15 +2361,28 @@ class pass_late_warn_uninitialized : public gimple_opt_pass
 public:
   pass_late_warn_uninitialized (gcc::context *ctxt)
     : gimple_opt_pass (pass_data_late_warn_uninitialized, ctxt)
-  {}
+  {
+  }
 
   /* opt_pass methods: */
-  opt_pass * clone () { return new pass_late_warn_uninitialized (m_ctxt); }
-  virtual bool gate (function *) { return gate_warn_uninitialized (); }
+  opt_pass *clone ();
+  virtual bool gate (function *);
   virtual unsigned int execute (function *);
 
 }; // class pass_late_warn_uninitialized
 
+opt_pass *
+pass_late_warn_uninitialized::clone ()
+{
+  return new pass_late_warn_uninitialized (m_ctxt);
+}
+
+bool
+pass_late_warn_uninitialized::gate (function *)
+{
+  return gate_warn_uninitialized ();
+}
+
 unsigned int
 pass_late_warn_uninitialized::execute (function *fun)
 {
@@ -2437,8 +2418,7 @@ pass_late_warn_uninitialized::execute (function *fun)
 	for (i = 0; i < n; ++i)
 	  {
 	    tree op = gimple_phi_arg_def (phi, i);
-	    if (TREE_CODE (op) == SSA_NAME
-		&& uninit_undefined_value_p (op))
+	    if (TREE_CODE (op) == SSA_NAME && uninit_undefined_value_p (op))
 	      {
 		worklist.safe_push (phi);
 		added_to_worklist.add (phi);
@@ -2475,12 +2455,11 @@ make_pass_late_warn_uninitialized (gcc::context *ctxt)
   return new pass_late_warn_uninitialized (ctxt);
 }
 
-
 static unsigned int
 execute_early_warn_uninitialized (void)
 {
   /* Currently, this pass runs always but
-     execute_late_warn_uninitialized only runs with optimization. With
+     execute_late_warn_uninitialized only runs with optimization.  With
      optimization we want to warn about possible uninitialized as late
      as possible, thus don't do it here.  However, without
      optimization we need to warn here about "may be uninitialized".  */
@@ -2488,27 +2467,26 @@ execute_early_warn_uninitialized (void)
 
   warn_uninitialized_vars (/*warn_possibly_uninitialized=*/!optimize);
 
-  /* Post-dominator information can not be reliably updated. Free it
+  /* Post-dominator information can not be reliably updated.  Free it
      after the use.  */
 
   free_dominance_info (CDI_POST_DOMINATORS);
   return 0;
 }
 
-
 namespace {
 
 const pass_data pass_data_early_warn_uninitialized =
 {
-  GIMPLE_PASS, /* type */
+  GIMPLE_PASS,		       /* type */
   "*early_warn_uninitialized", /* name */
-  OPTGROUP_NONE, /* optinfo_flags */
-  TV_TREE_UNINIT, /* tv_id */
-  PROP_ssa, /* properties_required */
-  0, /* properties_provided */
-  0, /* properties_destroyed */
-  0, /* todo_flags_start */
-  0, /* todo_flags_finish */
+  OPTGROUP_NONE,	       /* optinfo_flags */
+  TV_TREE_UNINIT,	       /* tv_id */
+  PROP_ssa,		       /* properties_required */
+  0,			       /* properties_provided */
+  0,			       /* properties_destroyed */
+  0,			       /* todo_flags_start */
+  0,			       /* todo_flags_finish */
 };
 
 class pass_early_warn_uninitialized : public gimple_opt_pass
@@ -2519,14 +2497,23 @@ public:
   {}
 
   /* opt_pass methods: */
-  virtual bool gate (function *) { return gate_warn_uninitialized (); }
-  virtual unsigned int execute (function *)
-    {
-      return execute_early_warn_uninitialized ();
-    }
+  virtual bool gate (function *);
+  virtual unsigned int execute (function *);
 
 }; // class pass_early_warn_uninitialized
 
+bool
+pass_early_warn_uninitialized::gate (function *)
+{
+  return gate_warn_uninitialized ();
+}
+
+unsigned int
+pass_early_warn_uninitialized::execute (function *)
+{
+  return execute_early_warn_uninitialized ();
+}
+
 } // anon namespace
 
 gimple_opt_pass *
-- 
2.6.2


^ permalink raw reply	[flat|nested] 42+ messages in thread

* Re: [PATCH] Fix memory leaks in tree-ssa-uninit.c
  2015-11-19 10:17             ` Martin Liška
@ 2015-11-19 13:58               ` Bernd Schmidt
  2015-11-19 14:57                 ` Martin Liška
  2015-11-19 17:34                 ` [PATCH] Fix memory leaks " Jeff Law
  0 siblings, 2 replies; 42+ messages in thread
From: Bernd Schmidt @ 2015-11-19 13:58 UTC (permalink / raw)
  To: Martin Liška, gcc-patches, joseph

On 11/19/2015 11:16 AM, Martin Liška wrote:
> You are right, however as the original coding style was really broken,
> it was much easier
> to use the tool and clean-up fall-out.
>
> Waiting for thoughts related to v2.

Better, but still some oddities. I hope you won't get mad at me if I 
suggest doing this in stages? A first patch could just deal with 
non-reformatting whitespace changes, such as removing trailing 
whitespace, and converting leading spaces to tabs - that would be 
mechanical, and reduce the size of the rest of the patch (it seems emacs 
has an appropriate command, M-x whitespace-cleanup). Such a change is 
preapproved.

A few things I noticed:

> -   flag_1 = phi <0, 1>                  // (1)
> +   flag_1 = phi <0, 1>		  // (1)

Check whether the // (1) is still lined up with the // (2) and // (3) 
parts. In general I'm not sure we should to what extent we should be 
reformatting comments in this patch. Breaking long lines and ensuring 
two spaces after a period seems fine.

> +   Checking recursively into (1), the compiler can find out that only some_val
> +   (which is defined) can flow into (3) which is OK.
>
>  */

Could take the opportunity to move the */ onto the end of the line.

> +	  if (is_gimple_call (cond_stmt) && EDGE_COUNT (e->src->succs) >= 2)
> +	    {
> +	      /* Ignore EH edge.  Can add assertion
> +		 on the other edge's flag.  */
> +	      continue;
> +	    }

Could also take the opportunity to remove excess braces and parentheses. 
Not a requirement and probably a distraction at this point.

> -  return (pred.cond_code == NE_EXPR && !pred.invert)
> -          || (pred.cond_code == EQ_EXPR && pred.invert);
> +  return (pred.cond_code == NE_EXPR && !pred.invert)
> +	 || (pred.cond_code == EQ_EXPR && pred.invert);

This still isn't right.


Bernd

^ permalink raw reply	[flat|nested] 42+ messages in thread

* Re: [PATCH] Fix memory leaks in tree-ssa-uninit.c
  2015-11-19 13:58               ` Bernd Schmidt
@ 2015-11-19 14:57                 ` Martin Liška
  2015-11-20  2:14                   ` Bernd Schmidt
  2015-11-19 17:34                 ` [PATCH] Fix memory leaks " Jeff Law
  1 sibling, 1 reply; 42+ messages in thread
From: Martin Liška @ 2015-11-19 14:57 UTC (permalink / raw)
  To: Bernd Schmidt, gcc-patches, joseph

[-- Attachment #1: Type: text/plain, Size: 2098 bytes --]

On 11/19/2015 02:58 PM, Bernd Schmidt wrote:
> On 11/19/2015 11:16 AM, Martin Liška wrote:
>> You are right, however as the original coding style was really broken,
>> it was much easier
>> to use the tool and clean-up fall-out.
>>
>> Waiting for thoughts related to v2.
> 
> Better, but still some oddities. I hope you won't get mad at me if I suggest doing this in stages? A first patch could just deal with non-reformatting whitespace changes, such as removing trailing whitespace, and converting leading spaces to tabs - that would be mechanical, and reduce the size of the rest of the patch (it seems emacs has an appropriate command, M-x whitespace-cleanup). Such a change is preapproved.

Hi.

That's good approach, let's start with that.

> 
> A few things I noticed:
> 
>> -   flag_1 = phi <0, 1>                  // (1)
>> +   flag_1 = phi <0, 1>          // (1)
> 
> Check whether the // (1) is still lined up with the // (2) and // (3) parts. In general I'm not sure we should to what extent we should be reformatting comments in this patch. Breaking long lines and ensuring two spaces after a period seems fine.

Fixed.

> 
>> +   Checking recursively into (1), the compiler can find out that only some_val
>> +   (which is defined) can flow into (3) which is OK.
>>
>>  */
> 
> Could take the opportunity to move the */ onto the end of the line.

Likewise.

> 
>> +      if (is_gimple_call (cond_stmt) && EDGE_COUNT (e->src->succs) >= 2)
>> +        {
>> +          /* Ignore EH edge.  Can add assertion
>> +         on the other edge's flag.  */
>> +          continue;
>> +        }
> 
> Could also take the opportunity to remove excess braces and parentheses. Not a requirement and probably a distraction at this point.

Likewise.

> 
>> -  return (pred.cond_code == NE_EXPR && !pred.invert)
>> -          || (pred.cond_code == EQ_EXPR && pred.invert);
>> +  return (pred.cond_code == NE_EXPR && !pred.invert)
>> +     || (pred.cond_code == EQ_EXPR && pred.invert);
> 
> This still isn't right.

Also fixed.

The patch has been split to two files.

Thanks,
Martin

> 
> 
> Bernd


[-- Attachment #2: 0001-Replace-spaces-with-tabs-and-remove-trailing-whitesp.patch --]
[-- Type: text/x-patch, Size: 48427 bytes --]

From 5a1de38916beefca319ef38df89a3a3b60c17a95 Mon Sep 17 00:00:00 2001
From: marxin <mliska@suse.cz>
Date: Thu, 19 Nov 2015 15:41:38 +0100
Subject: [PATCH 1/2] Replace spaces with tabs and remove trailing whitespaces

---
 gcc/tree-ssa-uninit.c | 1004 ++++++++++++++++++++++++-------------------------
 1 file changed, 502 insertions(+), 502 deletions(-)

diff --git a/gcc/tree-ssa-uninit.c b/gcc/tree-ssa-uninit.c
index 0709cce..50bfb03 100644
--- a/gcc/tree-ssa-uninit.c
+++ b/gcc/tree-ssa-uninit.c
@@ -76,8 +76,8 @@ static bool
 has_undefined_value_p (tree t)
 {
   return (ssa_undefined_value_p (t)
-          || (possibly_undefined_names
-              && possibly_undefined_names->contains (t)));
+	  || (possibly_undefined_names
+	      && possibly_undefined_names->contains (t)));
 }
 
 
@@ -270,9 +270,9 @@ can_skip_redundant_opnd (tree opnd, gimple *phi)
     {
       tree op = gimple_phi_arg_def (op_def, i);
       if (TREE_CODE (op) != SSA_NAME)
-        continue;
+	continue;
       if (op != phi_def && uninit_undefined_value_p (op))
-        return false;
+	return false;
     }
 
   return true;
@@ -296,10 +296,10 @@ compute_uninit_opnds_pos (gphi *phi)
     {
       tree op = gimple_phi_arg_def (phi, i);
       if (TREE_CODE (op) == SSA_NAME
-          && uninit_undefined_value_p (op)
-          && !can_skip_redundant_opnd (op, phi))
+	  && uninit_undefined_value_p (op)
+	  && !can_skip_redundant_opnd (op, phi))
 	{
-          if (cfun->has_nonlocal_label || cfun->calls_setjmp)
+	  if (cfun->has_nonlocal_label || cfun->calls_setjmp)
 	    {
 	      /* Ignore SSA_NAMEs that appear on abnormal edges
 		 somewhere.  */
@@ -323,7 +323,7 @@ find_pdom (basic_block block)
    else
      {
        basic_block bb
-           = get_immediate_dominator (CDI_POST_DOMINATORS, block);
+	   = get_immediate_dominator (CDI_POST_DOMINATORS, block);
        if (! bb)
 	 return EXIT_BLOCK_PTR_FOR_FN (cfun);
        return bb;
@@ -398,8 +398,8 @@ find_control_equiv_block (basic_block bb)
 
 static bool
 compute_control_dep_chain (basic_block bb, basic_block dep_bb,
-                           vec<edge> *cd_chains,
-                           size_t *num_chains,
+			   vec<edge> *cd_chains,
+			   size_t *num_chains,
 			   vec<edge> *cur_cd_chain,
 			   int *num_calls)
 {
@@ -426,7 +426,7 @@ compute_control_dep_chain (basic_block bb, basic_block dep_bb,
       edge e = (*cur_cd_chain)[i];
       /* Cycle detected. */
       if (e->src == bb)
-        return false;
+	return false;
     }
 
   FOR_EACH_EDGE (e, ei, bb->succs)
@@ -434,39 +434,39 @@ compute_control_dep_chain (basic_block bb, basic_block dep_bb,
       basic_block cd_bb;
       int post_dom_check = 0;
       if (e->flags & (EDGE_FAKE | EDGE_ABNORMAL))
-        continue;
+	continue;
 
       cd_bb = e->dest;
       cur_cd_chain->safe_push (e);
       while (!is_non_loop_exit_postdominating (cd_bb, bb))
-        {
-          if (cd_bb == dep_bb)
-            {
-              /* Found a direct control dependence.  */
-              if (*num_chains < MAX_NUM_CHAINS)
-                {
-                  cd_chains[*num_chains] = cur_cd_chain->copy ();
-                  (*num_chains)++;
-                }
-              found_cd_chain = true;
-              /* Check path from next edge.  */
-              break;
-            }
-
-          /* Now check if DEP_BB is indirectly control dependent on BB.  */
-          if (compute_control_dep_chain (cd_bb, dep_bb, cd_chains,
+	{
+	  if (cd_bb == dep_bb)
+	    {
+	      /* Found a direct control dependence.  */
+	      if (*num_chains < MAX_NUM_CHAINS)
+		{
+		  cd_chains[*num_chains] = cur_cd_chain->copy ();
+		  (*num_chains)++;
+		}
+	      found_cd_chain = true;
+	      /* Check path from next edge.  */
+	      break;
+	    }
+
+	  /* Now check if DEP_BB is indirectly control dependent on BB.  */
+	  if (compute_control_dep_chain (cd_bb, dep_bb, cd_chains,
 					 num_chains, cur_cd_chain, num_calls))
-            {
-              found_cd_chain = true;
-              break;
-            }
+	    {
+	      found_cd_chain = true;
+	      break;
+	    }
 
-          cd_bb = find_pdom (cd_bb);
-          post_dom_check++;
+	  cd_bb = find_pdom (cd_bb);
+	  post_dom_check++;
 	  if (cd_bb == EXIT_BLOCK_PTR_FOR_FN (cfun) || post_dom_check >
 	      MAX_POSTDOM_CHECK)
-            break;
-        }
+	    break;
+	}
       cur_cd_chain->pop ();
       gcc_assert (cur_cd_chain->length () == cur_chain_len);
     }
@@ -508,8 +508,8 @@ typedef vec<pred_chain, va_heap, vl_ptr> pred_chain_union;
 
 static bool
 convert_control_dep_chain_into_preds (vec<edge> *dep_chains,
-                                      size_t num_chains,
-                                      pred_chain_union *preds)
+				      size_t num_chains,
+				      pred_chain_union *preds)
 {
   bool has_valid_pred = false;
   size_t i, j;
@@ -527,48 +527,48 @@ convert_control_dep_chain_into_preds (vec<edge> *dep_chains,
       has_valid_pred = false;
       pred_chain t_chain = vNULL;
       for (j = 0; j < one_cd_chain.length (); j++)
-        {
+	{
 	  gimple *cond_stmt;
-          gimple_stmt_iterator gsi;
-          basic_block guard_bb;
-          pred_info one_pred;
-          edge e;
-
-          e = one_cd_chain[j];
-          guard_bb = e->src;
-          gsi = gsi_last_bb (guard_bb);
-          if (gsi_end_p (gsi))
-            {
-              has_valid_pred = false;
-              break;
-            }
-          cond_stmt = gsi_stmt (gsi);
-          if (is_gimple_call (cond_stmt)
-              && EDGE_COUNT (e->src->succs) >= 2)
-            {
-              /* Ignore EH edge. Can add assertion
-                 on the other edge's flag.  */
-              continue;
-            }
-          /* Skip if there is essentially one succesor.  */
-          if (EDGE_COUNT (e->src->succs) == 2)
-            {
-              edge e1;
-              edge_iterator ei1;
-              bool skip = false;
-
-              FOR_EACH_EDGE (e1, ei1, e->src->succs)
-                {
-                  if (EDGE_COUNT (e1->dest->succs) == 0)
-                    {
-                      skip = true;
-                      break;
-                    }
-                }
-              if (skip)
-                continue;
-            }
-          if (gimple_code (cond_stmt) == GIMPLE_COND)
+	  gimple_stmt_iterator gsi;
+	  basic_block guard_bb;
+	  pred_info one_pred;
+	  edge e;
+
+	  e = one_cd_chain[j];
+	  guard_bb = e->src;
+	  gsi = gsi_last_bb (guard_bb);
+	  if (gsi_end_p (gsi))
+	    {
+	      has_valid_pred = false;
+	      break;
+	    }
+	  cond_stmt = gsi_stmt (gsi);
+	  if (is_gimple_call (cond_stmt)
+	      && EDGE_COUNT (e->src->succs) >= 2)
+	    {
+	      /* Ignore EH edge. Can add assertion
+		 on the other edge's flag.  */
+	      continue;
+	    }
+	  /* Skip if there is essentially one succesor.  */
+	  if (EDGE_COUNT (e->src->succs) == 2)
+	    {
+	      edge e1;
+	      edge_iterator ei1;
+	      bool skip = false;
+
+	      FOR_EACH_EDGE (e1, ei1, e->src->succs)
+		{
+		  if (EDGE_COUNT (e1->dest->succs) == 0)
+		    {
+		      skip = true;
+		      break;
+		    }
+		}
+	      if (skip)
+		continue;
+	    }
+	  if (gimple_code (cond_stmt) == GIMPLE_COND)
 	    {
 	      one_pred.pred_lhs = gimple_cond_lhs (cond_stmt);
 	      one_pred.pred_rhs = gimple_cond_rhs (cond_stmt);
@@ -603,7 +603,7 @@ convert_control_dep_chain_into_preds (vec<edge> *dep_chains,
 		    }
 		}
 	      /* If more than one label reaches this block or the case
-	         label doesn't have a single value (like the default one)
+		 label doesn't have a single value (like the default one)
 		 fail.  */
 	      if (!l
 		  || !CASE_LOW (l)
@@ -621,11 +621,11 @@ convert_control_dep_chain_into_preds (vec<edge> *dep_chains,
 	      has_valid_pred = true;
 	    }
 	  else
-            {
-              has_valid_pred = false;
-              break;
-            }
-        }
+	    {
+	      has_valid_pred = false;
+	      break;
+	    }
+	}
 
       if (!has_valid_pred)
 	break;
@@ -642,8 +642,8 @@ convert_control_dep_chain_into_preds (vec<edge> *dep_chains,
 
 static bool
 find_predicates (pred_chain_union *preds,
-                 basic_block phi_bb,
-                 basic_block use_bb)
+		 basic_block phi_bb,
+		 basic_block use_bb)
 {
   size_t num_chains = 0, i;
   int num_calls = 0;
@@ -659,9 +659,9 @@ find_predicates (pred_chain_union *preds,
     {
       basic_block ctrl_eq_bb = find_control_equiv_block (cd_root);
       if (ctrl_eq_bb && dominated_by_p (CDI_DOMINATORS, use_bb, ctrl_eq_bb))
-        cd_root = ctrl_eq_bb;
+	cd_root = ctrl_eq_bb;
       else
-        break;
+	break;
     }
 
   compute_control_dep_chain (cd_root, use_bb, dep_chains, &num_chains,
@@ -699,33 +699,33 @@ collect_phi_def_edges (gphi *phi, basic_block cd_root,
       opnd = gimple_phi_arg_def (phi, i);
 
       if (TREE_CODE (opnd) != SSA_NAME)
-        {
-          if (dump_file && (dump_flags & TDF_DETAILS))
-            {
-              fprintf (dump_file, "\n[CHECK] Found def edge %d in ", (int)i);
-              print_gimple_stmt (dump_file, phi, 0, 0);
-            }
-          edges->safe_push (opnd_edge);
-        }
+	{
+	  if (dump_file && (dump_flags & TDF_DETAILS))
+	    {
+	      fprintf (dump_file, "\n[CHECK] Found def edge %d in ", (int)i);
+	      print_gimple_stmt (dump_file, phi, 0, 0);
+	    }
+	  edges->safe_push (opnd_edge);
+	}
       else
-        {
+	{
 	  gimple *def = SSA_NAME_DEF_STMT (opnd);
 
-          if (gimple_code (def) == GIMPLE_PHI
-              && dominated_by_p (CDI_DOMINATORS,
-                                 gimple_bb (def), cd_root))
-            collect_phi_def_edges (as_a <gphi *> (def), cd_root, edges,
-                                   visited_phis);
-          else if (!uninit_undefined_value_p (opnd))
-            {
-              if (dump_file && (dump_flags & TDF_DETAILS))
-                {
-                  fprintf (dump_file, "\n[CHECK] Found def edge %d in ", (int)i);
-                  print_gimple_stmt (dump_file, phi, 0, 0);
-                }
-              edges->safe_push (opnd_edge);
-            }
-        }
+	  if (gimple_code (def) == GIMPLE_PHI
+	      && dominated_by_p (CDI_DOMINATORS,
+				 gimple_bb (def), cd_root))
+	    collect_phi_def_edges (as_a <gphi *> (def), cd_root, edges,
+				   visited_phis);
+	  else if (!uninit_undefined_value_p (opnd))
+	    {
+	      if (dump_file && (dump_flags & TDF_DETAILS))
+		{
+		  fprintf (dump_file, "\n[CHECK] Found def edge %d in ", (int)i);
+		  print_gimple_stmt (dump_file, phi, 0, 0);
+		}
+	      edges->safe_push (opnd_edge);
+	    }
+	}
     }
 }
 
@@ -769,14 +769,14 @@ find_def_preds (pred_chain_union *preds, gphi *phi)
 				 &num_chains, &cur_chain, &num_calls);
 
       /* Now update the newly added chains with
-         the phi operand edge:  */
+	 the phi operand edge:  */
       if (EDGE_COUNT (opnd_edge->src->succs) > 1)
-        {
+	{
 	  if (prev_nc == num_chains && num_chains < MAX_NUM_CHAINS)
 	    dep_chains[num_chains++] = vNULL;
-          for (j = prev_nc; j < num_chains; j++)
+	  for (j = prev_nc; j < num_chains; j++)
 	    dep_chains[j].safe_push (opnd_edge);
-        }
+	}
     }
 
   has_valid_pred
@@ -790,7 +790,7 @@ find_def_preds (pred_chain_union *preds, gphi *phi)
 
 static void
 dump_predicates (gimple *usestmt, pred_chain_union preds,
-                 const char* msg)
+		 const char* msg)
 {
   size_t i, j;
   pred_chain one_pred_chain = vNULL;
@@ -807,22 +807,22 @@ dump_predicates (gimple *usestmt, pred_chain_union preds,
       np = one_pred_chain.length ();
 
       for (j = 0; j < np; j++)
-        {
-          pred_info one_pred = one_pred_chain[j];
-          if (one_pred.invert)
-            fprintf (dump_file, " (.NOT.) ");
-          print_generic_expr (dump_file, one_pred.pred_lhs, 0);
-          fprintf (dump_file, " %s ", op_symbol_code (one_pred.cond_code));
-          print_generic_expr (dump_file, one_pred.pred_rhs, 0);
-          if (j < np - 1)
-            fprintf (dump_file, " (.AND.) ");
-          else
-            fprintf (dump_file, "\n");
-        }
+	{
+	  pred_info one_pred = one_pred_chain[j];
+	  if (one_pred.invert)
+	    fprintf (dump_file, " (.NOT.) ");
+	  print_generic_expr (dump_file, one_pred.pred_lhs, 0);
+	  fprintf (dump_file, " %s ", op_symbol_code (one_pred.cond_code));
+	  print_generic_expr (dump_file, one_pred.pred_rhs, 0);
+	  if (j < np - 1)
+	    fprintf (dump_file, " (.AND.) ");
+	  else
+	    fprintf (dump_file, "\n");
+	}
       if (i < num_preds - 1)
-        fprintf (dump_file, "(.OR.)\n");
+	fprintf (dump_file, "(.OR.)\n");
       else
-        fprintf (dump_file, "\n\n");
+	fprintf (dump_file, "\n\n");
     }
 }
 
@@ -845,7 +845,7 @@ destroy_predicate_vecs (pred_chain_union *preds)
 
 static enum tree_code
 get_cmp_code (enum tree_code orig_cmp_code,
-              bool swap_cond, bool invert)
+	      bool swap_cond, bool invert)
 {
   enum tree_code tc = orig_cmp_code;
 
@@ -896,27 +896,27 @@ is_value_included_in (tree val, tree boundary, enum tree_code cmpc)
   if (is_unsigned)
     {
       if (cmpc == EQ_EXPR)
-        result = tree_int_cst_equal (val, boundary);
+	result = tree_int_cst_equal (val, boundary);
       else if (cmpc == LT_EXPR)
-        result = tree_int_cst_lt (val, boundary);
+	result = tree_int_cst_lt (val, boundary);
       else
-        {
-          gcc_assert (cmpc == LE_EXPR);
-          result = tree_int_cst_le (val, boundary);
-        }
+	{
+	  gcc_assert (cmpc == LE_EXPR);
+	  result = tree_int_cst_le (val, boundary);
+	}
     }
   else
     {
       if (cmpc == EQ_EXPR)
-        result = tree_int_cst_equal (val, boundary);
+	result = tree_int_cst_equal (val, boundary);
       else if (cmpc == LT_EXPR)
-        result = tree_int_cst_lt (val, boundary);
+	result = tree_int_cst_lt (val, boundary);
       else
-        {
-          gcc_assert (cmpc == LE_EXPR);
-          result = (tree_int_cst_equal (val, boundary)
-                    || tree_int_cst_lt (val, boundary));
-        }
+	{
+	  gcc_assert (cmpc == LE_EXPR);
+	  result = (tree_int_cst_equal (val, boundary)
+		    || tree_int_cst_lt (val, boundary));
+	}
     }
 
   if (inverted)
@@ -931,8 +931,8 @@ is_value_included_in (tree val, tree boundary, enum tree_code cmpc)
 
 static bool
 find_matching_predicate_in_rest_chains (pred_info pred,
-                                        pred_chain_union preds,
-                                        size_t num_pred_chains)
+					pred_chain_union preds,
+					size_t num_pred_chains)
 {
   size_t i, j, n;
 
@@ -946,24 +946,24 @@ find_matching_predicate_in_rest_chains (pred_info pred,
       pred_chain one_chain = preds[i];
       n = one_chain.length ();
       for (j = 0; j < n; j++)
-        {
-          pred_info pred2 = one_chain[j];
-          /* Can relax the condition comparison to not
-             use address comparison. However, the most common
-             case is that multiple control dependent paths share
-             a common path prefix, so address comparison should
-             be ok.  */
-
-          if (operand_equal_p (pred2.pred_lhs, pred.pred_lhs, 0)
-              && operand_equal_p (pred2.pred_rhs, pred.pred_rhs, 0)
-              && pred2.invert == pred.invert)
-            {
-              found = true;
-              break;
-            }
-        }
+	{
+	  pred_info pred2 = one_chain[j];
+	  /* Can relax the condition comparison to not
+	     use address comparison. However, the most common
+	     case is that multiple control dependent paths share
+	     a common path prefix, so address comparison should
+	     be ok.  */
+
+	  if (operand_equal_p (pred2.pred_lhs, pred.pred_lhs, 0)
+	      && operand_equal_p (pred2.pred_rhs, pred.pred_rhs, 0)
+	      && pred2.invert == pred.invert)
+	    {
+	      found = true;
+	      break;
+	    }
+	}
       if (!found)
-        return false;
+	return false;
     }
   return true;
 }
@@ -971,11 +971,11 @@ find_matching_predicate_in_rest_chains (pred_info pred,
 /* Forward declaration.  */
 static bool
 is_use_properly_guarded (gimple *use_stmt,
-                         basic_block use_bb,
-                         gphi *phi,
-                         unsigned uninit_opnds,
+			 basic_block use_bb,
+			 gphi *phi,
+			 unsigned uninit_opnds,
 			 pred_chain_union *def_preds,
-                         hash_set<gphi *> *visited_phis);
+			 hash_set<gphi *> *visited_phis);
 
 /* Returns true if all uninitialized opnds are pruned. Returns false
    otherwise. PHI is the phi node with uninitialized operands,
@@ -990,7 +990,7 @@ is_use_properly_guarded (gimple *use_stmt,
    Example scenario:
 
    BB1:
-   flag_1 = phi <0, 1>                  // (1)
+   flag_1 = phi <0, 1>		  // (1)
    var_1  = phi <undef, some_val>
 
 
@@ -1001,7 +1001,7 @@ is_use_properly_guarded (gimple *use_stmt,
       goto BB3;
 
    BB3:
-   use of var_2                         // (3)
+   use of var_2			 // (3)
 
    Because some flag arg in (1) is not constant, if we do not look into the
    flag phis recursively, it is conservatively treated as unknown and var_1
@@ -1027,77 +1027,77 @@ prune_uninit_phi_opnds_in_unrealizable_paths (gphi *phi,
       tree flag_arg;
 
       if (!MASK_TEST_BIT (uninit_opnds, i))
-        continue;
+	continue;
 
       flag_arg = gimple_phi_arg_def (flag_def, i);
       if (!is_gimple_constant (flag_arg))
-        {
-          gphi *flag_arg_def, *phi_arg_def;
-          tree phi_arg;
-          unsigned uninit_opnds_arg_phi;
-
-          if (TREE_CODE (flag_arg) != SSA_NAME)
-            return false;
-          flag_arg_def = dyn_cast <gphi *> (SSA_NAME_DEF_STMT (flag_arg));
+	{
+	  gphi *flag_arg_def, *phi_arg_def;
+	  tree phi_arg;
+	  unsigned uninit_opnds_arg_phi;
+
+	  if (TREE_CODE (flag_arg) != SSA_NAME)
+	    return false;
+	  flag_arg_def = dyn_cast <gphi *> (SSA_NAME_DEF_STMT (flag_arg));
 	  if (!flag_arg_def)
-            return false;
+	    return false;
 
-          phi_arg = gimple_phi_arg_def (phi, i);
-          if (TREE_CODE (phi_arg) != SSA_NAME)
-            return false;
+	  phi_arg = gimple_phi_arg_def (phi, i);
+	  if (TREE_CODE (phi_arg) != SSA_NAME)
+	    return false;
 
-          phi_arg_def = dyn_cast <gphi *> (SSA_NAME_DEF_STMT (phi_arg));
+	  phi_arg_def = dyn_cast <gphi *> (SSA_NAME_DEF_STMT (phi_arg));
 	  if (!phi_arg_def)
-            return false;
+	    return false;
 
-          if (gimple_bb (phi_arg_def) != gimple_bb (flag_arg_def))
-            return false;
+	  if (gimple_bb (phi_arg_def) != gimple_bb (flag_arg_def))
+	    return false;
 
-          if (!*visited_flag_phis)
-            *visited_flag_phis = BITMAP_ALLOC (NULL);
+	  if (!*visited_flag_phis)
+	    *visited_flag_phis = BITMAP_ALLOC (NULL);
 
-          if (bitmap_bit_p (*visited_flag_phis,
-                            SSA_NAME_VERSION (gimple_phi_result (flag_arg_def))))
-            return false;
+	  if (bitmap_bit_p (*visited_flag_phis,
+			    SSA_NAME_VERSION (gimple_phi_result (flag_arg_def))))
+	    return false;
 
-          bitmap_set_bit (*visited_flag_phis,
-                          SSA_NAME_VERSION (gimple_phi_result (flag_arg_def)));
+	  bitmap_set_bit (*visited_flag_phis,
+			  SSA_NAME_VERSION (gimple_phi_result (flag_arg_def)));
 
-          /* Now recursively prune the uninitialized phi args.  */
-          uninit_opnds_arg_phi = compute_uninit_opnds_pos (phi_arg_def);
-          if (!prune_uninit_phi_opnds_in_unrealizable_paths
+	  /* Now recursively prune the uninitialized phi args.  */
+	  uninit_opnds_arg_phi = compute_uninit_opnds_pos (phi_arg_def);
+	  if (!prune_uninit_phi_opnds_in_unrealizable_paths
 		 (phi_arg_def, uninit_opnds_arg_phi, flag_arg_def,
 		  boundary_cst, cmp_code, visited_phis, visited_flag_phis))
-            return false;
+	    return false;
 
-          bitmap_clear_bit (*visited_flag_phis,
-                            SSA_NAME_VERSION (gimple_phi_result (flag_arg_def)));
-          continue;
-        }
+	  bitmap_clear_bit (*visited_flag_phis,
+			    SSA_NAME_VERSION (gimple_phi_result (flag_arg_def)));
+	  continue;
+	}
 
       /* Now check if the constant is in the guarded range.  */
       if (is_value_included_in (flag_arg, boundary_cst, cmp_code))
-        {
-          tree opnd;
+	{
+	  tree opnd;
 	  gimple *opnd_def;
 
-          /* Now that we know that this undefined edge is not
-             pruned. If the operand is defined by another phi,
-             we can further prune the incoming edges of that
-             phi by checking the predicates of this operands.  */
-
-          opnd = gimple_phi_arg_def (phi, i);
-          opnd_def = SSA_NAME_DEF_STMT (opnd);
-          if (gphi *opnd_def_phi = dyn_cast <gphi *> (opnd_def))
-            {
-              edge opnd_edge;
-              unsigned uninit_opnds2
-                  = compute_uninit_opnds_pos (opnd_def_phi);
-              pred_chain_union def_preds = vNULL;
-              bool ok;
-              gcc_assert (!MASK_EMPTY (uninit_opnds2));
-              opnd_edge = gimple_phi_arg_edge (phi, i);
-              ok = is_use_properly_guarded (phi,
+	  /* Now that we know that this undefined edge is not
+	     pruned. If the operand is defined by another phi,
+	     we can further prune the incoming edges of that
+	     phi by checking the predicates of this operands.  */
+
+	  opnd = gimple_phi_arg_def (phi, i);
+	  opnd_def = SSA_NAME_DEF_STMT (opnd);
+	  if (gphi *opnd_def_phi = dyn_cast <gphi *> (opnd_def))
+	    {
+	      edge opnd_edge;
+	      unsigned uninit_opnds2
+		  = compute_uninit_opnds_pos (opnd_def_phi);
+	      pred_chain_union def_preds = vNULL;
+	      bool ok;
+	      gcc_assert (!MASK_EMPTY (uninit_opnds2));
+	      opnd_edge = gimple_phi_arg_edge (phi, i);
+	      ok = is_use_properly_guarded (phi,
 					    opnd_edge->src,
 					    opnd_def_phi,
 					    uninit_opnds2,
@@ -1106,10 +1106,10 @@ prune_uninit_phi_opnds_in_unrealizable_paths (gphi *phi,
 	      destroy_predicate_vecs (&def_preds);
 	      if (!ok)
 		return false;
-            }
-          else
-            return false;
-        }
+	    }
+	  else
+	    return false;
+	}
     }
 
   return true;
@@ -1119,50 +1119,50 @@ prune_uninit_phi_opnds_in_unrealizable_paths (gphi *phi,
    of the use is not overlapping with that of the uninit paths.
    The most common senario of guarded use is in Example 1:
      Example 1:
-           if (some_cond)
-           {
-              x = ...;
-              flag = true;
-           }
+	   if (some_cond)
+	   {
+	      x = ...;
+	      flag = true;
+	   }
 
-            ... some code ...
+	    ... some code ...
 
-           if (flag)
-              use (x);
+	   if (flag)
+	      use (x);
 
      The real world examples are usually more complicated, but similar
      and usually result from inlining:
 
-         bool init_func (int * x)
-         {
-             if (some_cond)
-                return false;
-             *x  =  ..
-             return true;
-         }
+	 bool init_func (int * x)
+	 {
+	     if (some_cond)
+		return false;
+	     *x  =  ..
+	     return true;
+	 }
 
-         void foo(..)
-         {
-             int x;
+	 void foo(..)
+	 {
+	     int x;
 
-             if (!init_func(&x))
-                return;
+	     if (!init_func(&x))
+		return;
 
-             .. some_code ...
-             use (x);
-         }
+	     .. some_code ...
+	     use (x);
+	 }
 
      Another possible use scenario is in the following trivial example:
 
      Example 2:
-          if (n > 0)
-             x = 1;
-          ...
-          if (n > 0)
-            {
-              if (m < 2)
-                 .. = x;
-            }
+	  if (n > 0)
+	     x = 1;
+	  ...
+	  if (n > 0)
+	    {
+	      if (m < 2)
+		 .. = x;
+	    }
 
      Predicate analysis needs to compute the composite predicate:
 
@@ -1173,8 +1173,8 @@ prune_uninit_phi_opnds_in_unrealizable_paths (gphi *phi,
        bb and is dominating the operand def.)
 
        and check overlapping:
-          (n > 0) .AND. (m < 2) .AND. (.NOT. (n > 0))
-        <==> false
+	  (n > 0) .AND. (m < 2) .AND. (.NOT. (n > 0))
+	<==> false
 
      This implementation provides framework that can handle
      scenarios. (Note that many simple cases are handled properly
@@ -1191,7 +1191,7 @@ prune_uninit_phi_opnds_in_unrealizable_paths (gphi *phi,
 
 static bool
 use_pred_not_overlap_with_undef_path_pred (pred_chain_union preds,
-				           gphi *phi, unsigned uninit_opnds,
+					   gphi *phi, unsigned uninit_opnds,
 					   hash_set<gphi *> *visited_phis)
 {
   unsigned int i, n;
@@ -1223,32 +1223,32 @@ use_pred_not_overlap_with_undef_path_pred (pred_chain_union preds,
       cmp_code = the_pred.cond_code;
 
       if (cond_lhs != NULL_TREE && TREE_CODE (cond_lhs) == SSA_NAME
-          && cond_rhs != NULL_TREE && is_gimple_constant (cond_rhs))
-        {
-          boundary_cst = cond_rhs;
-          flag = cond_lhs;
-        }
+	  && cond_rhs != NULL_TREE && is_gimple_constant (cond_rhs))
+	{
+	  boundary_cst = cond_rhs;
+	  flag = cond_lhs;
+	}
       else if (cond_rhs != NULL_TREE && TREE_CODE (cond_rhs) == SSA_NAME
-               && cond_lhs != NULL_TREE && is_gimple_constant (cond_lhs))
-        {
-          boundary_cst = cond_lhs;
-          flag = cond_rhs;
-          swap_cond = true;
-        }
+	       && cond_lhs != NULL_TREE && is_gimple_constant (cond_lhs))
+	{
+	  boundary_cst = cond_lhs;
+	  flag = cond_rhs;
+	  swap_cond = true;
+	}
 
       if (!flag)
-        continue;
+	continue;
 
       flag_def = SSA_NAME_DEF_STMT (flag);
 
       if (!flag_def)
-        continue;
+	continue;
 
       if ((gimple_code (flag_def) == GIMPLE_PHI)
-          && (gimple_bb (flag_def) == gimple_bb (phi))
-          && find_matching_predicate_in_rest_chains (the_pred, preds,
+	  && (gimple_bb (flag_def) == gimple_bb (phi))
+	  && find_matching_predicate_in_rest_chains (the_pred, preds,
 						     num_preds))
-        break;
+	break;
 
       flag_def = 0;
     }
@@ -1264,12 +1264,12 @@ use_pred_not_overlap_with_undef_path_pred (pred_chain_union preds,
     return false;
 
   all_pruned = prune_uninit_phi_opnds_in_unrealizable_paths (phi,
-                                                             uninit_opnds,
-                                                             as_a <gphi *> (flag_def),
-                                                             boundary_cst,
-                                                             cmp_code,
-                                                             visited_phis,
-                                                             &visited_flag_phis);
+							     uninit_opnds,
+							     as_a <gphi *> (flag_def),
+							     boundary_cst,
+							     cmp_code,
+							     visited_phis,
+							     &visited_flag_phis);
 
   if (visited_flag_phis)
     BITMAP_FREE (visited_flag_phis);
@@ -1305,13 +1305,13 @@ static inline bool
 is_neq_relop_p (pred_info pred)
 {
 
-  return (pred.cond_code == NE_EXPR && !pred.invert) 
-          || (pred.cond_code == EQ_EXPR && pred.invert);
+  return (pred.cond_code == NE_EXPR && !pred.invert)
+	  || (pred.cond_code == EQ_EXPR && pred.invert);
 }
 
 /* Returns true if pred is of the form X != 0.  */
 
-static inline bool 
+static inline bool
 is_neq_zero_form_p (pred_info pred)
 {
   if (!is_neq_relop_p (pred) || !integer_zerop (pred.pred_rhs)
@@ -1377,7 +1377,7 @@ is_pred_expr_subset_of (pred_info expr1, pred_info expr2)
 
 static bool
 is_pred_chain_subset_of (pred_chain pred1,
-                         pred_chain pred2)
+			 pred_chain pred2)
 {
   size_t np1, np2, i1, i2;
 
@@ -1389,16 +1389,16 @@ is_pred_chain_subset_of (pred_chain pred1,
       bool found = false;
       pred_info info2 = pred2[i2];
       for (i1 = 0; i1 < np1; i1++)
-        {
-          pred_info info1 = pred1[i1];
-          if (is_pred_expr_subset_of (info1, info2))
-            {
-              found = true;
-              break;
-            }
-        }
+	{
+	  pred_info info1 = pred1[i1];
+	  if (is_pred_expr_subset_of (info1, info2))
+	    {
+	      found = true;
+	      break;
+	    }
+	}
       if (!found)
-        return false;
+	return false;
     }
   return true;
 }
@@ -1421,7 +1421,7 @@ is_included_in (pred_chain one_pred, pred_chain_union preds)
   for (i = 0; i < n; i++)
     {
       if (is_pred_chain_subset_of (one_pred, preds[i]))
-        return true;
+	return true;
     }
 
   return false;
@@ -1452,7 +1452,7 @@ is_superset_of (pred_chain_union preds1, pred_chain_union preds2)
     {
       one_pred_chain = preds2[i];
       if (!is_included_in (one_pred_chain, preds1))
-        return false;
+	return false;
     }
 
   return true;
@@ -1464,8 +1464,8 @@ static inline bool
 is_and_or_or_p (enum tree_code tc, tree type)
 {
   return (tc == BIT_IOR_EXPR
-          || (tc == BIT_AND_EXPR
-              && (type == 0 || TREE_CODE (type) == BOOLEAN_TYPE)));
+	  || (tc == BIT_AND_EXPR
+	      && (type == 0 || TREE_CODE (type) == BOOLEAN_TYPE)));
 }
 
 /* Returns true if X1 is the negate of X2.  */
@@ -1477,7 +1477,7 @@ pred_neg_p (pred_info x1, pred_info x2)
   if (!operand_equal_p (x1.pred_lhs, x2.pred_lhs, 0)
       || !operand_equal_p (x1.pred_rhs, x2.pred_rhs, 0))
     return false;
-      
+
   c1 = x1.cond_code;
   if (x1.invert == x2.invert)
     c2 = invert_tree_comparison (x2.cond_code, false);
@@ -1493,7 +1493,7 @@ pred_neg_p (pred_info x1, pred_info x2)
    4) ((x IAND y) != 0) || (x != 0 AND y != 0)) is equivalent to
       (x != 0 AND y != 0)
    5) (X AND Y) OR (!X AND Z) OR (!Y AND Z) is equivalent to
-      (X AND Y) OR Z 
+      (X AND Y) OR Z
 
    PREDS is the predicate chains, and N is the number of chains.  */
 
@@ -1514,35 +1514,35 @@ simplify_pred (pred_chain *one_chain)
       pred_info *a_pred = &(*one_chain)[i];
 
       if (!a_pred->pred_lhs)
-        continue;
+	continue;
       if (!is_neq_zero_form_p (*a_pred))
-        continue;
+	continue;
 
       gimple *def_stmt = SSA_NAME_DEF_STMT (a_pred->pred_lhs);
       if (gimple_code (def_stmt) != GIMPLE_ASSIGN)
-        continue;
+	continue;
       if (gimple_assign_rhs_code (def_stmt) == BIT_IOR_EXPR)
-        {
-          for (j = 0; j < n; j++)
-            {
-              pred_info *b_pred = &(*one_chain)[j];
-
-              if (!b_pred->pred_lhs)
-                continue;
-              if (!is_neq_zero_form_p (*b_pred))
-                continue;
-
-              if (pred_expr_equal_p (*b_pred, gimple_assign_rhs1 (def_stmt))
-                  || pred_expr_equal_p (*b_pred, gimple_assign_rhs2 (def_stmt)))
-                 {
-                   /* Mark a_pred for removal.  */
-                   a_pred->pred_lhs = NULL;
-                   a_pred->pred_rhs = NULL;
-                   simplified = true;
-                   break;
-                 }
-            }
-        }
+	{
+	  for (j = 0; j < n; j++)
+	    {
+	      pred_info *b_pred = &(*one_chain)[j];
+
+	      if (!b_pred->pred_lhs)
+		continue;
+	      if (!is_neq_zero_form_p (*b_pred))
+		continue;
+
+	      if (pred_expr_equal_p (*b_pred, gimple_assign_rhs1 (def_stmt))
+		  || pred_expr_equal_p (*b_pred, gimple_assign_rhs2 (def_stmt)))
+		 {
+		   /* Mark a_pred for removal.  */
+		   a_pred->pred_lhs = NULL;
+		   a_pred->pred_rhs = NULL;
+		   simplified = true;
+		   break;
+		 }
+	    }
+	}
     }
 
   if (!simplified)
@@ -1552,7 +1552,7 @@ simplify_pred (pred_chain *one_chain)
     {
       pred_info *a_pred = &(*one_chain)[i];
       if (!a_pred->pred_lhs)
-        continue;
+	continue;
       s_chain.safe_push (*a_pred);
     }
 
@@ -1572,7 +1572,7 @@ simplify_preds_2 (pred_chain_union *preds)
   bool simplified = false;
   pred_chain_union s_preds = vNULL;
 
-  /* (X AND Y) OR (!X AND Y) is equivalent to Y.  
+  /* (X AND Y) OR (!X AND Y) is equivalent to Y.
      (X AND Y) OR (X AND !Y) is equivalent to X.  */
 
   n = preds->length ();
@@ -1582,55 +1582,55 @@ simplify_preds_2 (pred_chain_union *preds)
       pred_chain *a_chain = &(*preds)[i];
 
       if (a_chain->length () != 2)
-        continue;
+	continue;
 
       x = (*a_chain)[0];
       y = (*a_chain)[1];
 
       for (j = 0; j < n; j++)
-        {
-          pred_chain *b_chain;
-          pred_info x2, y2;
-
-          if (j == i)
-            continue;
-
-          b_chain = &(*preds)[j];
-          if (b_chain->length () != 2)
-            continue;
-
-          x2 = (*b_chain)[0];
-          y2 = (*b_chain)[1];
-
-          if (pred_equal_p (x, x2) && pred_neg_p (y, y2))
-            {
-              /* Kill a_chain.  */
-              a_chain->release ();
-              b_chain->release ();
-              b_chain->safe_push (x);
-              simplified = true;
-              break;
-            }
-          if (pred_neg_p (x, x2) && pred_equal_p (y, y2))
-            {
-              /* Kill a_chain.  */
-              a_chain->release ();
-              b_chain->release ();
-              b_chain->safe_push (y);
-              simplified = true;
-              break;
-            }
-        }
+	{
+	  pred_chain *b_chain;
+	  pred_info x2, y2;
+
+	  if (j == i)
+	    continue;
+
+	  b_chain = &(*preds)[j];
+	  if (b_chain->length () != 2)
+	    continue;
+
+	  x2 = (*b_chain)[0];
+	  y2 = (*b_chain)[1];
+
+	  if (pred_equal_p (x, x2) && pred_neg_p (y, y2))
+	    {
+	      /* Kill a_chain.  */
+	      a_chain->release ();
+	      b_chain->release ();
+	      b_chain->safe_push (x);
+	      simplified = true;
+	      break;
+	    }
+	  if (pred_neg_p (x, x2) && pred_equal_p (y, y2))
+	    {
+	      /* Kill a_chain.  */
+	      a_chain->release ();
+	      b_chain->release ();
+	      b_chain->safe_push (y);
+	      simplified = true;
+	      break;
+	    }
+	}
     }
   /* Now clean up the chain.  */
   if (simplified)
     {
       for (i = 0; i < n; i++)
-        {
-          if ((*preds)[i].is_empty ())
-            continue;
-          s_preds.safe_push ((*preds)[i]);
-        }
+	{
+	  if ((*preds)[i].is_empty ())
+	    continue;
+	  s_preds.safe_push ((*preds)[i]);
+	}
       preds->release ();
       (*preds) = s_preds;
       s_preds = vNULL;
@@ -1663,34 +1663,34 @@ simplify_preds_3 (pred_chain_union *preds)
       pred_chain *a_chain = &(*preds)[i];
 
       if (a_chain->length () != 1)
-        continue;
+	continue;
 
       x = (*a_chain)[0];
 
       for (j = 0; j < n; j++)
-        {
-          pred_chain *b_chain;
-          pred_info x2;
-          size_t k;
-
-          if (j == i)
-            continue;
-
-          b_chain = &(*preds)[j];
-          if (b_chain->length () < 2)
-            continue;
-
-          for (k = 0; k < b_chain->length (); k++)
-            {
-              x2 = (*b_chain)[k];
-              if (pred_neg_p (x, x2))
-                {
-                  b_chain->unordered_remove (k);
-                  simplified = true;
-                  break;
-                }
-            }
-        }
+	{
+	  pred_chain *b_chain;
+	  pred_info x2;
+	  size_t k;
+
+	  if (j == i)
+	    continue;
+
+	  b_chain = &(*preds)[j];
+	  if (b_chain->length () < 2)
+	    continue;
+
+	  for (k = 0; k < b_chain->length (); k++)
+	    {
+	      x2 = (*b_chain)[k];
+	      if (pred_neg_p (x, x2))
+		{
+		  b_chain->unordered_remove (k);
+		  simplified = true;
+		  break;
+		}
+	    }
+	}
     }
   return simplified;
 }
@@ -1716,59 +1716,59 @@ simplify_preds_4 (pred_chain_union *preds)
       pred_chain *a_chain = &(*preds)[i];
 
       if (a_chain->length () != 1)
-        continue;
+	continue;
 
       z = (*a_chain)[0];
 
       if (!is_neq_zero_form_p (z))
-        continue;
+	continue;
 
       def_stmt = SSA_NAME_DEF_STMT (z.pred_lhs);
       if (gimple_code (def_stmt) != GIMPLE_ASSIGN)
-        continue;
+	continue;
 
       if (gimple_assign_rhs_code (def_stmt) != BIT_AND_EXPR)
-        continue;
+	continue;
 
       for (j = 0; j < n; j++)
-        {
-          pred_chain *b_chain;
-          pred_info x2, y2;
-
-          if (j == i)
-            continue;
-
-          b_chain = &(*preds)[j];
-          if (b_chain->length () != 2)
-            continue;
-
-          x2 = (*b_chain)[0];
-          y2 = (*b_chain)[1];
-          if (!is_neq_zero_form_p (x2)
-              || !is_neq_zero_form_p (y2))
-            continue;
-
-          if ((pred_expr_equal_p (x2, gimple_assign_rhs1 (def_stmt))
-               && pred_expr_equal_p (y2, gimple_assign_rhs2 (def_stmt)))
-              || (pred_expr_equal_p (x2, gimple_assign_rhs2 (def_stmt))
-                  && pred_expr_equal_p (y2, gimple_assign_rhs1 (def_stmt))))
-            {
-              /* Kill a_chain.  */
-              a_chain->release ();
-              simplified = true;
-              break;
-            }
-        }
+	{
+	  pred_chain *b_chain;
+	  pred_info x2, y2;
+
+	  if (j == i)
+	    continue;
+
+	  b_chain = &(*preds)[j];
+	  if (b_chain->length () != 2)
+	    continue;
+
+	  x2 = (*b_chain)[0];
+	  y2 = (*b_chain)[1];
+	  if (!is_neq_zero_form_p (x2)
+	      || !is_neq_zero_form_p (y2))
+	    continue;
+
+	  if ((pred_expr_equal_p (x2, gimple_assign_rhs1 (def_stmt))
+	       && pred_expr_equal_p (y2, gimple_assign_rhs2 (def_stmt)))
+	      || (pred_expr_equal_p (x2, gimple_assign_rhs2 (def_stmt))
+		  && pred_expr_equal_p (y2, gimple_assign_rhs1 (def_stmt))))
+	    {
+	      /* Kill a_chain.  */
+	      a_chain->release ();
+	      simplified = true;
+	      break;
+	    }
+	}
     }
   /* Now clean up the chain.  */
   if (simplified)
     {
       for (i = 0; i < n; i++)
-        {
-          if ((*preds)[i].is_empty ())
-            continue;
-          s_preds.safe_push ((*preds)[i]);
-        }
+	{
+	  if ((*preds)[i].is_empty ())
+	    continue;
+	  s_preds.safe_push ((*preds)[i]);
+	}
 
       destroy_predicate_vecs (preds);
       (*preds) = s_preds;
@@ -1804,15 +1804,15 @@ simplify_preds (pred_chain_union *preds, gimple *use_or_def, bool is_use)
     {
       changed = false;
       if (simplify_preds_2 (preds))
-        changed = true;
+	changed = true;
 
       /* Now iteratively simplify X OR (!X AND Z ..)
        into X OR (Z ...).  */
       if (simplify_preds_3 (preds))
-        changed = true;
+	changed = true;
 
       if (simplify_preds_4 (preds))
-        changed = true;
+	changed = true;
 
     } while (changed);
 
@@ -1821,7 +1821,7 @@ simplify_preds (pred_chain_union *preds, gimple *use_or_def, bool is_use)
 
 /* This is a helper function which attempts to normalize predicate chains
   by following UD chains. It basically builds up a big tree of either IOR
-  operations or AND operations, and convert the IOR tree into a 
+  operations or AND operations, and convert the IOR tree into a
   pred_chain_union or BIT_AND tree into a pred_chain.
   Example:
 
@@ -1846,7 +1846,7 @@ simplify_preds (pred_chain_union *preds, gimple *use_or_def, bool is_use)
 
  then _t != 0 will be normalized into a pred_chain:
    (_2 RELOP1 _1) AND (_5 RELOP2 _4) AND (_8 RELOP3 _7) AND (_0 != 0)
-   
+
   */
 
 /* This is a helper function that stores a PRED into NORM_PREDS.  */
@@ -1864,7 +1864,7 @@ push_pred (pred_chain_union *norm_preds, pred_info pred)
 
 inline static void
 push_to_worklist (tree op, vec<pred_info, va_heap, vl_ptr> *work_list,
-                  hash_set<tree> *mark_set)
+		  hash_set<tree> *mark_set)
 {
   if (mark_set->contains (op))
     return;
@@ -1925,52 +1925,52 @@ is_degenerated_phi (gimple *phi, pred_info *pred_p)
       tree op = gimple_phi_arg_def (phi, i);
 
       if (TREE_CODE (op) != SSA_NAME)
-        return false;
+	return false;
 
       def = SSA_NAME_DEF_STMT (op);
       if (gimple_code (def) != GIMPLE_ASSIGN)
-        return false;
+	return false;
       if (TREE_CODE_CLASS (gimple_assign_rhs_code (def))
-          != tcc_comparison)
-        return false;
+	  != tcc_comparison)
+	return false;
       pred = get_pred_info_from_cmp (def);
       if (!pred_equal_p (pred, pred0))
-        return false;
+	return false;
     }
 
   *pred_p = pred0;
   return true;
 }
 
-/* Normalize one predicate PRED  
+/* Normalize one predicate PRED
    1) if PRED can no longer be normlized, put it into NORM_PREDS.
    2) otherwise if PRED is of the form x != 0, follow x's definition
       and put normalized predicates into WORK_LIST.  */
- 
+
 static void
-normalize_one_pred_1 (pred_chain_union *norm_preds, 
-                      pred_chain *norm_chain,
-                      pred_info pred,
-                      enum tree_code and_or_code,
-                      vec<pred_info, va_heap, vl_ptr> *work_list,
+normalize_one_pred_1 (pred_chain_union *norm_preds,
+		      pred_chain *norm_chain,
+		      pred_info pred,
+		      enum tree_code and_or_code,
+		      vec<pred_info, va_heap, vl_ptr> *work_list,
 		      hash_set<tree> *mark_set)
 {
   if (!is_neq_zero_form_p (pred))
     {
       if (and_or_code == BIT_IOR_EXPR)
-        push_pred (norm_preds, pred);
+	push_pred (norm_preds, pred);
       else
-        norm_chain->safe_push (pred);
+	norm_chain->safe_push (pred);
       return;
     }
 
   gimple *def_stmt = SSA_NAME_DEF_STMT (pred.pred_lhs);
- 
+
   if (gimple_code (def_stmt) == GIMPLE_PHI
       && is_degenerated_phi (def_stmt, &pred))
     work_list->safe_push (pred);
   else if (gimple_code (def_stmt) == GIMPLE_PHI
-           && and_or_code == BIT_IOR_EXPR)
+	   && and_or_code == BIT_IOR_EXPR)
     {
       int i, n;
       n = gimple_phi_num_args (def_stmt);
@@ -1978,23 +1978,23 @@ normalize_one_pred_1 (pred_chain_union *norm_preds,
       /* If we see non zero constant, we should punt. The predicate
        * should be one guarding the phi edge.  */
       for (i = 0; i < n; ++i)
-        {
-          tree op = gimple_phi_arg_def (def_stmt, i);
-          if (TREE_CODE (op) == INTEGER_CST && !integer_zerop (op))
-            {
-              push_pred (norm_preds, pred);
-              return;
-            }
-        }
+	{
+	  tree op = gimple_phi_arg_def (def_stmt, i);
+	  if (TREE_CODE (op) == INTEGER_CST && !integer_zerop (op))
+	    {
+	      push_pred (norm_preds, pred);
+	      return;
+	    }
+	}
 
       for (i = 0; i < n; ++i)
-        {
-          tree op = gimple_phi_arg_def (def_stmt, i);
-          if (integer_zerop (op))
-            continue;
+	{
+	  tree op = gimple_phi_arg_def (def_stmt, i);
+	  if (integer_zerop (op))
+	    continue;
 
-          push_to_worklist (op, work_list, mark_set);
-        }
+	  push_to_worklist (op, work_list, mark_set);
+	}
     }
   else if (gimple_code (def_stmt) != GIMPLE_ASSIGN)
     {
@@ -2047,7 +2047,7 @@ normalize_one_pred_1 (pred_chain_union *norm_preds,
 
 static void
 normalize_one_pred (pred_chain_union *norm_preds,
-                    pred_info pred)
+		    pred_info pred)
 {
   vec<pred_info, va_heap, vl_ptr> work_list = vNULL;
   enum tree_code and_or_code = ERROR_MARK;
@@ -2066,13 +2066,13 @@ normalize_one_pred (pred_chain_union *norm_preds,
       && and_or_code != BIT_AND_EXPR)
     {
       if (TREE_CODE_CLASS (and_or_code)
-          == tcc_comparison)
-        {
-          pred_info n_pred = get_pred_info_from_cmp (def_stmt);
-          push_pred (norm_preds, n_pred);
-        } 
+	  == tcc_comparison)
+	{
+	  pred_info n_pred = get_pred_info_from_cmp (def_stmt);
+	  push_pred (norm_preds, n_pred);
+	}
        else
-          push_pred (norm_preds, pred);
+	  push_pred (norm_preds, pred);
       return;
     }
 
@@ -2083,7 +2083,7 @@ normalize_one_pred (pred_chain_union *norm_preds,
     {
       pred_info a_pred = work_list.pop ();
       normalize_one_pred_1 (norm_preds, &norm_chain, a_pred,
-                            and_or_code, &work_list, &mark_set);
+			    and_or_code, &work_list, &mark_set);
     }
   if (and_or_code == BIT_AND_EXPR)
     norm_preds->safe_push (norm_chain);
@@ -2093,7 +2093,7 @@ normalize_one_pred (pred_chain_union *norm_preds,
 
 static void
 normalize_one_pred_chain (pred_chain_union *norm_preds,
-                          pred_chain one_chain)
+			  pred_chain one_chain)
 {
   vec<pred_info, va_heap, vl_ptr> work_list = vNULL;
   hash_set<tree> mark_set;
@@ -2110,7 +2110,7 @@ normalize_one_pred_chain (pred_chain_union *norm_preds,
     {
       pred_info a_pred = work_list.pop ();
       normalize_one_pred_1 (0, &norm_chain, a_pred,
-                            BIT_AND_EXPR, &work_list, &mark_set);
+			    BIT_AND_EXPR, &work_list, &mark_set);
     }
 
   norm_preds->safe_push (norm_chain);
@@ -2135,12 +2135,12 @@ normalize_preds (pred_chain_union preds, gimple *use_or_def, bool is_use)
   for (i = 0; i < n; i++)
     {
       if (preds[i].length () != 1)
-        normalize_one_pred_chain (&norm_preds, preds[i]);
+	normalize_one_pred_chain (&norm_preds, preds[i]);
       else
-        {
-          normalize_one_pred (&norm_preds, preds[i][0]);
-          preds[i].release ();
-        }
+	{
+	  normalize_one_pred (&norm_preds, preds[i][0]);
+	  preds[i].release ();
+	}
     }
 
   if (dump_file)
@@ -2177,11 +2177,11 @@ normalize_preds (pred_chain_union preds, gimple *use_or_def, bool is_use)
 
 static bool
 is_use_properly_guarded (gimple *use_stmt,
-                         basic_block use_bb,
-                         gphi *phi,
-                         unsigned uninit_opnds,
+			 basic_block use_bb,
+			 gphi *phi,
+			 unsigned uninit_opnds,
 			 pred_chain_union *def_preds,
-                         hash_set<gphi *> *visited_phis)
+			 hash_set<gphi *> *visited_phis)
 {
   basic_block phi_bb;
   pred_chain_union preds = vNULL;
@@ -2249,7 +2249,7 @@ is_use_properly_guarded (gimple *use_stmt,
 
 static gimple *
 find_uninit_use (gphi *phi, unsigned uninit_opnds,
-                 vec<gphi *> *worklist,
+		 vec<gphi *> *worklist,
 		 hash_set<gphi *> *added_to_worklist)
 {
   tree phi_result;
@@ -2281,10 +2281,10 @@ find_uninit_use (gphi *phi, unsigned uninit_opnds,
 	continue;
 
       if (dump_file && (dump_flags & TDF_DETAILS))
-        {
-          fprintf (dump_file, "[CHECK]: Found unguarded use: ");
-          print_gimple_stmt (dump_file, use_stmt, 0, 0);
-        }
+	{
+	  fprintf (dump_file, "[CHECK]: Found unguarded use: ");
+	  print_gimple_stmt (dump_file, use_stmt, 0, 0);
+	}
       /* Found one real use, return.  */
       if (gimple_code (use_stmt) != GIMPLE_PHI)
 	{
@@ -2293,18 +2293,18 @@ find_uninit_use (gphi *phi, unsigned uninit_opnds,
 	}
 
       /* Found a phi use that is not guarded,
-         add the phi to the worklist.  */
+	 add the phi to the worklist.  */
       if (!added_to_worklist->add (as_a <gphi *> (use_stmt)))
-        {
-          if (dump_file && (dump_flags & TDF_DETAILS))
-            {
-              fprintf (dump_file, "[WORKLIST]: Update worklist with phi: ");
-              print_gimple_stmt (dump_file, use_stmt, 0, 0);
-            }
-
-          worklist->safe_push (as_a <gphi *> (use_stmt));
-          possibly_undefined_names->add (phi_result);
-        }
+	{
+	  if (dump_file && (dump_flags & TDF_DETAILS))
+	    {
+	      fprintf (dump_file, "[WORKLIST]: Update worklist with phi: ");
+	      print_gimple_stmt (dump_file, use_stmt, 0, 0);
+	    }
+
+	  worklist->safe_push (as_a <gphi *> (use_stmt));
+	  possibly_undefined_names->add (phi_result);
+	}
     }
 
   destroy_predicate_vecs (&def_preds);
@@ -2321,7 +2321,7 @@ find_uninit_use (gphi *phi, unsigned uninit_opnds,
 
 static void
 warn_uninitialized_phi (gphi *phi, vec<gphi *> *worklist,
-                        hash_set<gphi *> *added_to_worklist)
+			hash_set<gphi *> *added_to_worklist)
 {
   unsigned uninit_opnds;
   gimple *uninit_use_stmt = 0;
@@ -2346,7 +2346,7 @@ warn_uninitialized_phi (gphi *phi, vec<gphi *> *worklist,
 
   /* Now check if we have any use of the value without proper guard.  */
   uninit_use_stmt = find_uninit_use (phi, uninit_opnds,
-                                     worklist, added_to_worklist);
+				     worklist, added_to_worklist);
 
   /* All uses are properly guarded.  */
   if (!uninit_use_stmt)
@@ -2362,8 +2362,8 @@ warn_uninitialized_phi (gphi *phi, vec<gphi *> *worklist,
     loc = UNKNOWN_LOCATION;
   warn_uninit (OPT_Wmaybe_uninitialized, uninit_op, SSA_NAME_VAR (uninit_op),
 	       SSA_NAME_VAR (uninit_op),
-               "%qD may be used uninitialized in this function",
-               uninit_use_stmt, loc);
+	       "%qD may be used uninitialized in this function",
+	       uninit_use_stmt, loc);
 
 }
 
-- 
2.6.3


[-- Attachment #3: 0002-Manual-changes-to-GCC-coding-style-in-tree-ssa-unini.patch --]
[-- Type: text/x-patch, Size: 42806 bytes --]

From fed0c22286d6150722186350d4415e701928082d Mon Sep 17 00:00:00 2001
From: marxin <mliska@suse.cz>
Date: Thu, 19 Nov 2015 15:44:47 +0100
Subject: [PATCH 2/2] Manual changes to GCC coding style in tree-ssa-uninit.c

gcc/ChangeLog:

2015-11-19  Martin Liska  <mliska@suse.cz>

	* tree-ssa-uninit.c (warn_uninit): Apply manual changes
	to the GNU coding style.
---
 gcc/tree-ssa-uninit.c | 463 ++++++++++++++++++++++++--------------------------
 1 file changed, 222 insertions(+), 241 deletions(-)

diff --git a/gcc/tree-ssa-uninit.c b/gcc/tree-ssa-uninit.c
index 50bfb03..e30e57e 100644
--- a/gcc/tree-ssa-uninit.c
+++ b/gcc/tree-ssa-uninit.c
@@ -35,16 +35,15 @@ along with GCC; see the file COPYING3.  If not see
 #include "tree-cfg.h"
 
 /* This implements the pass that does predicate aware warning on uses of
-   possibly uninitialized variables. The pass first collects the set of
-   possibly uninitialized SSA names. For each such name, it walks through
-   all its immediate uses. For each immediate use, it rebuilds the condition
-   expression (the predicate) that guards the use. The predicate is then
+   possibly uninitialized variables.  The pass first collects the set of
+   possibly uninitialized SSA names.  For each such name, it walks through
+   all its immediate uses.  For each immediate use, it rebuilds the condition
+   expression (the predicate) that guards the use.  The predicate is then
    examined to see if the variable is always defined under that same condition.
    This is done either by pruning the unrealizable paths that lead to the
    default definitions or by checking if the predicate set that guards the
    defining paths is a superset of the use predicate.  */
 
-
 /* Pointer set of potentially undefined ssa names, i.e.,
    ssa names that are defined by phi with operands that
    are not defined or potentially undefined.  */
@@ -56,7 +55,7 @@ static hash_set<tree> *possibly_undefined_names = 0;
 #define MASK_EMPTY(mask) (mask == 0)
 
 /* Returns the first bit position (starting from LSB)
-   in mask that is non zero. Returns -1 if the mask is empty.  */
+   in mask that is non zero.  Returns -1 if the mask is empty.  */
 static int
 get_mask_first_set_bit (unsigned mask)
 {
@@ -80,13 +79,12 @@ has_undefined_value_p (tree t)
 	      && possibly_undefined_names->contains (t)));
 }
 
-
-
 /* Like has_undefined_value_p, but don't return true if TREE_NO_WARNING
    is set on SSA_NAME_VAR.  */
 
 static inline bool
-uninit_undefined_value_p (tree t) {
+uninit_undefined_value_p (tree t)
+{
   if (!has_undefined_value_p (t))
     return false;
   if (SSA_NAME_VAR (t) && TREE_NO_WARNING (SSA_NAME_VAR (t)))
@@ -112,7 +110,7 @@ uninit_undefined_value_p (tree t) {
 /* Emit a warning for EXPR based on variable VAR at the point in the
    program T, an SSA_NAME, is used being uninitialized.  The exact
    warning text is in MSGID and DATA is the gimple stmt with info about
-   the location in source code. When DATA is a GIMPLE_PHI, PHIARG_IDX
+   the location in source code.  When DATA is a GIMPLE_PHI, PHIARG_IDX
    gives which argument of the phi node to take the location from.  WC
    is the warning code.  */
 
@@ -149,8 +147,7 @@ warn_uninit (enum opt_code wc, tree t, tree expr, tree var,
   else
     location = DECL_SOURCE_LOCATION (var);
   location = linemap_resolve_location (line_table, location,
-				       LRK_SPELLING_LOCATION,
-				       NULL);
+				       LRK_SPELLING_LOCATION, NULL);
   cfun_loc = DECL_SOURCE_LOCATION (cfun->decl);
   xloc = expand_location (location);
   floc = expand_location (cfun_loc);
@@ -161,10 +158,8 @@ warn_uninit (enum opt_code wc, tree t, tree expr, tree var,
       if (location == DECL_SOURCE_LOCATION (var))
 	return;
       if (xloc.file != floc.file
-	  || linemap_location_before_p (line_table,
-					location, cfun_loc)
-	  || linemap_location_before_p (line_table,
-					cfun->function_end_locus,
+	  || linemap_location_before_p (line_table, location, cfun_loc)
+	  || linemap_location_before_p (line_table, cfun->function_end_locus,
 					location))
 	inform (DECL_SOURCE_LOCATION (var), "%qD was declared here", var);
     }
@@ -178,8 +173,9 @@ warn_uninitialized_vars (bool warn_possibly_uninitialized)
 
   FOR_EACH_BB_FN (bb, cfun)
     {
-      bool always_executed = dominated_by_p (CDI_POST_DOMINATORS,
-					     single_succ (ENTRY_BLOCK_PTR_FOR_FN (cfun)), bb);
+      bool always_executed
+	= dominated_by_p (CDI_POST_DOMINATORS,
+			  single_succ (ENTRY_BLOCK_PTR_FOR_FN (cfun)), bb);
       for (gsi = gsi_start_bb (bb); !gsi_end_p (gsi); gsi_next (&gsi))
 	{
 	  gimple *stmt = gsi_stmt (gsi);
@@ -196,13 +192,13 @@ warn_uninitialized_vars (bool warn_possibly_uninitialized)
 	    {
 	      use = USE_FROM_PTR (use_p);
 	      if (always_executed)
-		warn_uninit (OPT_Wuninitialized, use,
-			     SSA_NAME_VAR (use), SSA_NAME_VAR (use),
-			     "%qD is used uninitialized in this function",
-			     stmt, UNKNOWN_LOCATION);
+		warn_uninit (OPT_Wuninitialized, use, SSA_NAME_VAR (use),
+			     SSA_NAME_VAR (use),
+			     "%qD is used uninitialized in this function", stmt,
+			     UNKNOWN_LOCATION);
 	      else if (warn_possibly_uninitialized)
-		warn_uninit (OPT_Wmaybe_uninitialized, use,
-			     SSA_NAME_VAR (use), SSA_NAME_VAR (use),
+		warn_uninit (OPT_Wmaybe_uninitialized, use, SSA_NAME_VAR (use),
+			     SSA_NAME_VAR (use),
 			     "%qD may be used uninitialized in this function",
 			     stmt, UNKNOWN_LOCATION);
 	    }
@@ -232,9 +228,8 @@ warn_uninitialized_vars (bool warn_possibly_uninitialized)
 		continue;
 
 	      if (always_executed)
-		warn_uninit (OPT_Wuninitialized, use,
-			     gimple_assign_rhs1 (stmt), base,
-			     "%qE is used uninitialized in this function",
+		warn_uninit (OPT_Wuninitialized, use, gimple_assign_rhs1 (stmt),
+			     base, "%qE is used uninitialized in this function",
 			     stmt, UNKNOWN_LOCATION);
 	      else if (warn_possibly_uninitialized)
 		warn_uninit (OPT_Wmaybe_uninitialized, use,
@@ -250,9 +245,9 @@ warn_uninitialized_vars (bool warn_possibly_uninitialized)
 
 /* Checks if the operand OPND of PHI is defined by
    another phi with one operand defined by this PHI,
-   but the rest operands are all defined. If yes,
+   but the rest operands are all defined.  If yes,
    returns true to skip this operand as being
-   redundant. Can be enhanced to be more general.  */
+   redundant.  Can be enhanced to be more general.  */
 
 static bool
 can_skip_redundant_opnd (tree opnd, gimple *phi)
@@ -318,37 +313,35 @@ compute_uninit_opnds_pos (gphi *phi)
 static inline basic_block
 find_pdom (basic_block block)
 {
-   if (block == EXIT_BLOCK_PTR_FOR_FN (cfun))
-     return EXIT_BLOCK_PTR_FOR_FN (cfun);
-   else
-     {
-       basic_block bb
-	   = get_immediate_dominator (CDI_POST_DOMINATORS, block);
-       if (! bb)
-	 return EXIT_BLOCK_PTR_FOR_FN (cfun);
-       return bb;
-     }
+  if (block == EXIT_BLOCK_PTR_FOR_FN (cfun))
+    return EXIT_BLOCK_PTR_FOR_FN (cfun);
+  else
+    {
+      basic_block bb = get_immediate_dominator (CDI_POST_DOMINATORS, block);
+      if (!bb)
+	return EXIT_BLOCK_PTR_FOR_FN (cfun);
+      return bb;
+    }
 }
 
-/* Find the immediate DOM of the specified
-   basic block BLOCK.  */
+/* Find the immediate DOM of the specified basic block BLOCK.  */
 
 static inline basic_block
 find_dom (basic_block block)
 {
-   if (block == ENTRY_BLOCK_PTR_FOR_FN (cfun))
-     return ENTRY_BLOCK_PTR_FOR_FN (cfun);
-   else
-     {
-       basic_block bb = get_immediate_dominator (CDI_DOMINATORS, block);
-       if (! bb)
-	 return ENTRY_BLOCK_PTR_FOR_FN (cfun);
-       return bb;
-     }
+  if (block == ENTRY_BLOCK_PTR_FOR_FN (cfun))
+    return ENTRY_BLOCK_PTR_FOR_FN (cfun);
+  else
+    {
+      basic_block bb = get_immediate_dominator (CDI_DOMINATORS, block);
+      if (!bb)
+	return ENTRY_BLOCK_PTR_FOR_FN (cfun);
+      return bb;
+    }
 }
 
 /* Returns true if BB1 is postdominating BB2 and BB1 is
-   not a loop exit bb. The loop exit bb check is simple and does
+   not a loop exit bb.  The loop exit bb check is simple and does
    not cover all cases.  */
 
 static bool
@@ -366,7 +359,7 @@ is_non_loop_exit_postdominating (basic_block bb1, basic_block bb2)
 /* Find the closest postdominator of a specified BB, which is control
    equivalent to BB.  */
 
-static inline  basic_block
+static inline basic_block
 find_control_equiv_block (basic_block bb)
 {
   basic_block pdom;
@@ -424,7 +417,7 @@ compute_control_dep_chain (basic_block bb, basic_block dep_bb,
   for (i = 0; i < cur_chain_len; i++)
     {
       edge e = (*cur_cd_chain)[i];
-      /* Cycle detected. */
+      /* Cycle detected.  */
       if (e->src == bb)
 	return false;
     }
@@ -454,8 +447,8 @@ compute_control_dep_chain (basic_block bb, basic_block dep_bb,
 	    }
 
 	  /* Now check if DEP_BB is indirectly control dependent on BB.  */
-	  if (compute_control_dep_chain (cd_bb, dep_bb, cd_chains,
-					 num_chains, cur_cd_chain, num_calls))
+	  if (compute_control_dep_chain (cd_bb, dep_bb, cd_chains, num_chains,
+					 cur_cd_chain, num_calls))
 	    {
 	      found_cd_chain = true;
 	      break;
@@ -463,8 +456,8 @@ compute_control_dep_chain (basic_block bb, basic_block dep_bb,
 
 	  cd_bb = find_pdom (cd_bb);
 	  post_dom_check++;
-	  if (cd_bb == EXIT_BLOCK_PTR_FOR_FN (cfun) || post_dom_check >
-	      MAX_POSTDOM_CHECK)
+	  if (cd_bb == EXIT_BLOCK_PTR_FOR_FN (cfun)
+	      || post_dom_check > MAX_POSTDOM_CHECK)
 	    break;
 	}
       cur_cd_chain->pop ();
@@ -475,7 +468,7 @@ compute_control_dep_chain (basic_block bb, basic_block dep_bb,
   return found_cd_chain;
 }
 
-/* The type to represent a simple predicate  */
+/* The type to represent a simple predicate.  */
 
 struct pred_info
 {
@@ -496,13 +489,13 @@ typedef vec<pred_info, va_heap, vl_ptr> pred_chain;
 typedef vec<pred_chain, va_heap, vl_ptr> pred_chain_union;
 
 /* Converts the chains of control dependence edges into a set of
-   predicates. A control dependence chain is represented by a vector
-   edges. DEP_CHAINS points to an array of dependence chains.
-   NUM_CHAINS is the size of the chain array. One edge in a dependence
+   predicates.  A control dependence chain is represented by a vector
+   edges.  DEP_CHAINS points to an array of dependence chains.
+   NUM_CHAINS is the size of the chain array.  One edge in a dependence
    chain is mapped to predicate expression represented by pred_info
-   type. One dependence chain is converted to a composite predicate that
+   type.  One dependence chain is converted to a composite predicate that
    is the result of AND operation of pred_info mapped to each edge.
-   A composite predicate is presented by a vector of pred_info. On
+   A composite predicate is presented by a vector of pred_info.  On
    return, *PREDS points to the resulting array of composite predicates.
    *NUM_PREDS is the number of composite predictes.  */
 
@@ -543,13 +536,9 @@ convert_control_dep_chain_into_preds (vec<edge> *dep_chains,
 	      break;
 	    }
 	  cond_stmt = gsi_stmt (gsi);
-	  if (is_gimple_call (cond_stmt)
-	      && EDGE_COUNT (e->src->succs) >= 2)
-	    {
-	      /* Ignore EH edge. Can add assertion
-		 on the other edge's flag.  */
-	      continue;
-	    }
+	  if (is_gimple_call (cond_stmt) && EDGE_COUNT (e->src->succs) >= 2)
+	    /* Ignore EH edge.  Can add assertion on the other edge's flag.  */
+	    continue;
 	  /* Skip if there is essentially one succesor.  */
 	  if (EDGE_COUNT (e->src->succs) == 2)
 	    {
@@ -577,7 +566,7 @@ convert_control_dep_chain_into_preds (vec<edge> *dep_chains,
 	      t_chain.safe_push (one_pred);
 	      has_valid_pred = true;
 	    }
-	  else if (gswitch *gs = dyn_cast <gswitch *> (cond_stmt))
+	  else if (gswitch *gs = dyn_cast<gswitch *> (cond_stmt))
 	    {
 	      /* Avoid quadratic behavior.  */
 	      if (gimple_switch_num_labels (gs) > MAX_SWITCH_CASES)
@@ -607,8 +596,8 @@ convert_control_dep_chain_into_preds (vec<edge> *dep_chains,
 		 fail.  */
 	      if (!l
 		  || !CASE_LOW (l)
-		  || (CASE_HIGH (l) && !operand_equal_p (CASE_LOW (l),
-							 CASE_HIGH (l), 0)))
+		  || (CASE_HIGH (l)
+		      && !operand_equal_p (CASE_LOW (l), CASE_HIGH (l), 0)))
 		{
 		  has_valid_pred = false;
 		  break;
@@ -635,7 +624,7 @@ convert_control_dep_chain_into_preds (vec<edge> *dep_chains,
   return has_valid_pred;
 }
 
-/* Computes all control dependence chains for USE_BB. The control
+/* Computes all control dependence chains for USE_BB.  The control
    dependence chains are then converted to an array of composite
    predicates pointed to by PREDS.  PHI_BB is the basic block of
    the phi whose result is used in USE_BB.  */
@@ -676,8 +665,8 @@ find_predicates (pred_chain_union *preds,
 
 /* Computes the set of incoming edges of PHI that have non empty
    definitions of a phi chain.  The collection will be done
-   recursively on operands that are defined by phis. CD_ROOT
-   is the control dependence root. *EDGES holds the result, and
+   recursively on operands that are defined by phis.  CD_ROOT
+   is the control dependence root.  *EDGES holds the result, and
    VISITED_PHIS is a pointer set for detecting cycles.  */
 
 static void
@@ -702,7 +691,7 @@ collect_phi_def_edges (gphi *phi, basic_block cd_root,
 	{
 	  if (dump_file && (dump_flags & TDF_DETAILS))
 	    {
-	      fprintf (dump_file, "\n[CHECK] Found def edge %d in ", (int)i);
+	      fprintf (dump_file, "\n[CHECK] Found def edge %d in ", (int) i);
 	      print_gimple_stmt (dump_file, phi, 0, 0);
 	    }
 	  edges->safe_push (opnd_edge);
@@ -712,15 +701,15 @@ collect_phi_def_edges (gphi *phi, basic_block cd_root,
 	  gimple *def = SSA_NAME_DEF_STMT (opnd);
 
 	  if (gimple_code (def) == GIMPLE_PHI
-	      && dominated_by_p (CDI_DOMINATORS,
-				 gimple_bb (def), cd_root))
-	    collect_phi_def_edges (as_a <gphi *> (def), cd_root, edges,
+	      && dominated_by_p (CDI_DOMINATORS, gimple_bb (def), cd_root))
+	    collect_phi_def_edges (as_a<gphi *> (def), cd_root, edges,
 				   visited_phis);
 	  else if (!uninit_undefined_value_p (opnd))
 	    {
 	      if (dump_file && (dump_flags & TDF_DETAILS))
 		{
-		  fprintf (dump_file, "\n[CHECK] Found def edge %d in ", (int)i);
+		  fprintf (dump_file, "\n[CHECK] Found def edge %d in ",
+			   (int) i);
 		  print_gimple_stmt (dump_file, phi, 0, 0);
 		}
 	      edges->safe_push (opnd_edge);
@@ -745,7 +734,7 @@ find_def_preds (pred_chain_union *preds, gphi *phi)
 
   phi_bb = gimple_bb (phi);
   /* First find the closest dominating bb to be
-     the control dependence root  */
+     the control dependence root.  */
   cd_root = find_dom (phi_bb);
   if (!cd_root)
     return false;
@@ -789,8 +778,7 @@ find_def_preds (pred_chain_union *preds, gphi *phi)
 /* Dumps the predicates (PREDS) for USESTMT.  */
 
 static void
-dump_predicates (gimple *usestmt, pred_chain_union preds,
-		 const char* msg)
+dump_predicates (gimple *usestmt, pred_chain_union preds, const char *msg)
 {
   size_t i, j;
   pred_chain one_pred_chain = vNULL;
@@ -839,13 +827,11 @@ destroy_predicate_vecs (pred_chain_union *preds)
   preds->release ();
 }
 
-
 /* Computes the 'normalized' conditional code with operand
    swapping and condition inversion.  */
 
 static enum tree_code
-get_cmp_code (enum tree_code orig_cmp_code,
-	      bool swap_cond, bool invert)
+get_cmp_code (enum tree_code orig_cmp_code, bool swap_cond, bool invert)
 {
   enum tree_code tc = orig_cmp_code;
 
@@ -880,14 +866,12 @@ is_value_included_in (tree val, tree boundary, enum tree_code cmpc)
   bool result;
 
   /* Only handle integer constant here.  */
-  if (TREE_CODE (val) != INTEGER_CST
-      || TREE_CODE (boundary) != INTEGER_CST)
+  if (TREE_CODE (val) != INTEGER_CST || TREE_CODE (boundary) != INTEGER_CST)
     return true;
 
   is_unsigned = TYPE_UNSIGNED (TREE_TYPE (val));
 
-  if (cmpc == GE_EXPR || cmpc == GT_EXPR
-      || cmpc == NE_EXPR)
+  if (cmpc == GE_EXPR || cmpc == GT_EXPR || cmpc == NE_EXPR)
     {
       cmpc = invert_tree_comparison (cmpc, false);
       inverted = true;
@@ -949,7 +933,7 @@ find_matching_predicate_in_rest_chains (pred_info pred,
 	{
 	  pred_info pred2 = one_chain[j];
 	  /* Can relax the condition comparison to not
-	     use address comparison. However, the most common
+	     use address comparison.  However, the most common
 	     case is that multiple control dependent paths share
 	     a common path prefix, so address comparison should
 	     be ok.  */
@@ -969,16 +953,15 @@ find_matching_predicate_in_rest_chains (pred_info pred,
 }
 
 /* Forward declaration.  */
-static bool
-is_use_properly_guarded (gimple *use_stmt,
-			 basic_block use_bb,
-			 gphi *phi,
-			 unsigned uninit_opnds,
-			 pred_chain_union *def_preds,
-			 hash_set<gphi *> *visited_phis);
-
-/* Returns true if all uninitialized opnds are pruned. Returns false
-   otherwise. PHI is the phi node with uninitialized operands,
+static bool is_use_properly_guarded (gimple *use_stmt,
+				     basic_block use_bb,
+				     gphi *phi,
+				     unsigned uninit_opnds,
+				     pred_chain_union *def_preds,
+				     hash_set<gphi *> *visited_phis);
+
+/* Returns true if all uninitialized opnds are pruned.  Returns false
+   otherwise.  PHI is the phi node with uninitialized operands,
    UNINIT_OPNDS is the bitmap of the uninitialize operand positions,
    FLAG_DEF is the statement defining the flag guarding the use of the
    PHI output, BOUNDARY_CST is the const value used in the predicate
@@ -990,7 +973,7 @@ is_use_properly_guarded (gimple *use_stmt,
    Example scenario:
 
    BB1:
-   flag_1 = phi <0, 1>		  // (1)
+   flag_1 = phi <0, 1>			// (1)
    var_1  = phi <undef, some_val>
 
 
@@ -1001,15 +984,14 @@ is_use_properly_guarded (gimple *use_stmt,
       goto BB3;
 
    BB3:
-   use of var_2			 // (3)
+   use of var_2				// (3)
 
    Because some flag arg in (1) is not constant, if we do not look into the
    flag phis recursively, it is conservatively treated as unknown and var_1
-   is thought to be flowed into use at (3). Since var_1 is potentially uninitialized
-   a false warning will be emitted. Checking recursively into (1), the compiler can
-   find out that only some_val (which is defined) can flow into (3) which is OK.
-
-*/
+   is thought to be flowed into use at (3).  Since var_1 is potentially
+   uninitialized a false warning will be emitted.
+   Checking recursively into (1), the compiler can find out that only some_val
+   (which is defined) can flow into (3) which is OK.  */
 
 static bool
 prune_uninit_phi_opnds_in_unrealizable_paths (gphi *phi,
@@ -1038,7 +1020,7 @@ prune_uninit_phi_opnds_in_unrealizable_paths (gphi *phi,
 
 	  if (TREE_CODE (flag_arg) != SSA_NAME)
 	    return false;
-	  flag_arg_def = dyn_cast <gphi *> (SSA_NAME_DEF_STMT (flag_arg));
+	  flag_arg_def = dyn_cast<gphi *> (SSA_NAME_DEF_STMT (flag_arg));
 	  if (!flag_arg_def)
 	    return false;
 
@@ -1046,7 +1028,7 @@ prune_uninit_phi_opnds_in_unrealizable_paths (gphi *phi,
 	  if (TREE_CODE (phi_arg) != SSA_NAME)
 	    return false;
 
-	  phi_arg_def = dyn_cast <gphi *> (SSA_NAME_DEF_STMT (phi_arg));
+	  phi_arg_def = dyn_cast<gphi *> (SSA_NAME_DEF_STMT (phi_arg));
 	  if (!phi_arg_def)
 	    return false;
 
@@ -1057,7 +1039,8 @@ prune_uninit_phi_opnds_in_unrealizable_paths (gphi *phi,
 	    *visited_flag_phis = BITMAP_ALLOC (NULL);
 
 	  if (bitmap_bit_p (*visited_flag_phis,
-			    SSA_NAME_VERSION (gimple_phi_result (flag_arg_def))))
+			    SSA_NAME_VERSION (
+			      gimple_phi_result (flag_arg_def))))
 	    return false;
 
 	  bitmap_set_bit (*visited_flag_phis,
@@ -1066,12 +1049,13 @@ prune_uninit_phi_opnds_in_unrealizable_paths (gphi *phi,
 	  /* Now recursively prune the uninitialized phi args.  */
 	  uninit_opnds_arg_phi = compute_uninit_opnds_pos (phi_arg_def);
 	  if (!prune_uninit_phi_opnds_in_unrealizable_paths
-		 (phi_arg_def, uninit_opnds_arg_phi, flag_arg_def,
-		  boundary_cst, cmp_code, visited_phis, visited_flag_phis))
+	      (phi_arg_def, uninit_opnds_arg_phi, flag_arg_def, boundary_cst,
+	       cmp_code, visited_phis, visited_flag_phis))
 	    return false;
 
 	  bitmap_clear_bit (*visited_flag_phis,
-			    SSA_NAME_VERSION (gimple_phi_result (flag_arg_def)));
+			    SSA_NAME_VERSION (
+			      gimple_phi_result (flag_arg_def)));
 	  continue;
 	}
 
@@ -1082,26 +1066,22 @@ prune_uninit_phi_opnds_in_unrealizable_paths (gphi *phi,
 	  gimple *opnd_def;
 
 	  /* Now that we know that this undefined edge is not
-	     pruned. If the operand is defined by another phi,
+	     pruned.  If the operand is defined by another phi,
 	     we can further prune the incoming edges of that
 	     phi by checking the predicates of this operands.  */
 
 	  opnd = gimple_phi_arg_def (phi, i);
 	  opnd_def = SSA_NAME_DEF_STMT (opnd);
-	  if (gphi *opnd_def_phi = dyn_cast <gphi *> (opnd_def))
+	  if (gphi *opnd_def_phi = dyn_cast<gphi *> (opnd_def))
 	    {
 	      edge opnd_edge;
-	      unsigned uninit_opnds2
-		  = compute_uninit_opnds_pos (opnd_def_phi);
+	      unsigned uninit_opnds2 = compute_uninit_opnds_pos (opnd_def_phi);
 	      pred_chain_union def_preds = vNULL;
 	      bool ok;
 	      gcc_assert (!MASK_EMPTY (uninit_opnds2));
 	      opnd_edge = gimple_phi_arg_edge (phi, i);
-	      ok = is_use_properly_guarded (phi,
-					    opnd_edge->src,
-					    opnd_def_phi,
-					    uninit_opnds2,
-					    &def_preds,
+	      ok = is_use_properly_guarded (phi, opnd_edge->src, opnd_def_phi,
+					    uninit_opnds2, &def_preds,
 					    visited_phis);
 	      destroy_predicate_vecs (&def_preds);
 	      if (!ok)
@@ -1141,11 +1121,11 @@ prune_uninit_phi_opnds_in_unrealizable_paths (gphi *phi,
 	     return true;
 	 }
 
-	 void foo(..)
+	 void foo (..)
 	 {
 	     int x;
 
-	     if (!init_func(&x))
+	     if (!init_func (&x))
 		return;
 
 	     .. some_code ...
@@ -1177,7 +1157,7 @@ prune_uninit_phi_opnds_in_unrealizable_paths (gphi *phi,
 	<==> false
 
      This implementation provides framework that can handle
-     scenarios. (Note that many simple cases are handled properly
+     scenarios.  (Note that many simple cases are handled properly
      without the predicate analysis -- this is due to jump threading
      transformation which eliminates the merge point thus makes
      path sensitive analysis unnecessary.)
@@ -1185,10 +1165,9 @@ prune_uninit_phi_opnds_in_unrealizable_paths (gphi *phi,
      NUM_PREDS is the number is the number predicate chains, PREDS is
      the array of chains, PHI is the phi node whose incoming (undefined)
      paths need to be pruned, and UNINIT_OPNDS is the bitmap holding
-     uninit operand positions. VISITED_PHIS is the pointer set of phi
+     uninit operand positions.  VISITED_PHIS is the pointer set of phi
      stmts being checked.  */
 
-
 static bool
 use_pred_not_overlap_with_undef_path_pred (pred_chain_union preds,
 					   gphi *phi, unsigned uninit_opnds,
@@ -1196,7 +1175,7 @@ use_pred_not_overlap_with_undef_path_pred (pred_chain_union preds,
 {
   unsigned int i, n;
   gimple *flag_def = 0;
-  tree  boundary_cst = 0;
+  tree boundary_cst = 0;
   enum tree_code cmp_code;
   bool swap_cond = false;
   bool invert = false;
@@ -1263,13 +1242,9 @@ use_pred_not_overlap_with_undef_path_pred (pred_chain_union preds,
   if (cmp_code == ERROR_MARK)
     return false;
 
-  all_pruned = prune_uninit_phi_opnds_in_unrealizable_paths (phi,
-							     uninit_opnds,
-							     as_a <gphi *> (flag_def),
-							     boundary_cst,
-							     cmp_code,
-							     visited_phis,
-							     &visited_flag_phis);
+  all_pruned = prune_uninit_phi_opnds_in_unrealizable_paths
+    (phi, uninit_opnds, as_a<gphi *> (flag_def), boundary_cst, cmp_code,
+     visited_phis, &visited_flag_phis);
 
   if (visited_flag_phis)
     BITMAP_FREE (visited_flag_phis);
@@ -1278,7 +1253,7 @@ use_pred_not_overlap_with_undef_path_pred (pred_chain_union preds,
 }
 
 /* The helper function returns true if two predicates X1 and X2
-   are equivalent. It assumes the expressions have already
+   are equivalent.  It assumes the expressions have already
    properly re-associated.  */
 
 static inline bool
@@ -1305,8 +1280,8 @@ static inline bool
 is_neq_relop_p (pred_info pred)
 {
 
-  return (pred.cond_code == NE_EXPR && !pred.invert)
-	  || (pred.cond_code == EQ_EXPR && pred.invert);
+  return ((pred.cond_code == NE_EXPR && !pred.invert)
+	  || (pred.cond_code == EQ_EXPR && pred.invert));
 }
 
 /* Returns true if pred is of the form X != 0.  */
@@ -1333,7 +1308,7 @@ pred_expr_equal_p (pred_info x1, tree x2)
 }
 
 /* Returns true of the domain of single predicate expression
-   EXPR1 is a subset of that of EXPR2. Returns false if it
+   EXPR1 is a subset of that of EXPR2.  Returns false if it
    can not be proved.  */
 
 static bool
@@ -1358,8 +1333,7 @@ is_pred_expr_subset_of (pred_info expr1, pred_info expr2)
   if (expr2.invert)
     code2 = invert_tree_comparison (code2, false);
 
-  if ((code1 == EQ_EXPR || code1 == BIT_AND_EXPR)
-      && code2 == BIT_AND_EXPR)
+  if ((code1 == EQ_EXPR || code1 == BIT_AND_EXPR) && code2 == BIT_AND_EXPR)
     return wi::eq_p (expr1.pred_rhs,
 		     wi::bit_and (expr1.pred_rhs, expr2.pred_rhs));
 
@@ -1373,11 +1347,10 @@ is_pred_expr_subset_of (pred_info expr1, pred_info expr2)
 }
 
 /* Returns true if the domain of PRED1 is a subset
-   of that of PRED2. Returns false if it can not be proved so.  */
+   of that of PRED2.  Returns false if it can not be proved so.  */
 
 static bool
-is_pred_chain_subset_of (pred_chain pred1,
-			 pred_chain pred2)
+is_pred_chain_subset_of (pred_chain pred1, pred_chain pred2)
 {
   size_t np1, np2, i1, i2;
 
@@ -1405,7 +1378,7 @@ is_pred_chain_subset_of (pred_chain pred1,
 
 /* Returns true if the domain defined by
    one pred chain ONE_PRED is a subset of the domain
-   of *PREDS. It returns false if ONE_PRED's domain is
+   of *PREDS.  It returns false if ONE_PRED's domain is
    not a subset of any of the sub-domains of PREDS
    (corresponding to each individual chains in it), even
    though it may be still be a subset of whole domain
@@ -1429,15 +1402,15 @@ is_included_in (pred_chain one_pred, pred_chain_union preds)
 
 /* Compares two predicate sets PREDS1 and PREDS2 and returns
    true if the domain defined by PREDS1 is a superset
-   of PREDS2's domain. N1 and N2 are array sizes of PREDS1 and
-   PREDS2 respectively. The implementation chooses not to build
+   of PREDS2's domain.  N1 and N2 are array sizes of PREDS1 and
+   PREDS2 respectively.  The implementation chooses not to build
    generic trees (and relying on the folding capability of the
    compiler), but instead performs brute force comparison of
    individual predicate chains (won't be a compile time problem
-   as the chains are pretty short). When the function returns
+   as the chains are pretty short).  When the function returns
    false, it does not necessarily mean *PREDS1 is not a superset
    of *PREDS2, but mean it may not be so since the analysis can
-   not prove it. In such cases, false warnings may still be
+   not prove it.  In such cases, false warnings may still be
    emitted.  */
 
 static bool
@@ -1534,19 +1507,19 @@ simplify_pred (pred_chain *one_chain)
 
 	      if (pred_expr_equal_p (*b_pred, gimple_assign_rhs1 (def_stmt))
 		  || pred_expr_equal_p (*b_pred, gimple_assign_rhs2 (def_stmt)))
-		 {
-		   /* Mark a_pred for removal.  */
-		   a_pred->pred_lhs = NULL;
-		   a_pred->pred_rhs = NULL;
-		   simplified = true;
-		   break;
-		 }
+		{
+		  /* Mark a_pred for removal.  */
+		  a_pred->pred_lhs = NULL;
+		  a_pred->pred_rhs = NULL;
+		  simplified = true;
+		  break;
+		}
 	    }
 	}
     }
 
   if (!simplified)
-     return;
+    return;
 
   for (i = 0; i < n; i++)
     {
@@ -1556,8 +1529,8 @@ simplify_pred (pred_chain *one_chain)
       s_chain.safe_push (*a_pred);
     }
 
-   one_chain->release ();
-   *one_chain = s_chain;
+  one_chain->release ();
+  *one_chain = s_chain;
 }
 
 /* The helper function implements the rule 2 for the
@@ -1744,8 +1717,7 @@ simplify_preds_4 (pred_chain_union *preds)
 
 	  x2 = (*b_chain)[0];
 	  y2 = (*b_chain)[1];
-	  if (!is_neq_zero_form_p (x2)
-	      || !is_neq_zero_form_p (y2))
+	  if (!is_neq_zero_form_p (x2) || !is_neq_zero_form_p (y2))
 	    continue;
 
 	  if ((pred_expr_equal_p (x2, gimple_assign_rhs1 (def_stmt))
@@ -1778,7 +1750,6 @@ simplify_preds_4 (pred_chain_union *preds)
   return simplified;
 }
 
-
 /* This function simplifies predicates in PREDS.  */
 
 static void
@@ -1813,14 +1784,14 @@ simplify_preds (pred_chain_union *preds, gimple *use_or_def, bool is_use)
 
       if (simplify_preds_4 (preds))
 	changed = true;
-
-    } while (changed);
+    }
+  while (changed);
 
   return;
 }
 
 /* This is a helper function which attempts to normalize predicate chains
-  by following UD chains. It basically builds up a big tree of either IOR
+  by following UD chains.  It basically builds up a big tree of either IOR
   operations or AND operations, and convert the IOR tree into a
   pred_chain_union or BIT_AND tree into a pred_chain.
   Example:
@@ -1893,7 +1864,7 @@ get_pred_info_from_cmp (gimple *cmp_assign)
 }
 
 /* Returns true if the PHI is a degenerated phi with
-   all args with the same value (relop). In that case, *PRED
+   all args with the same value (relop).  In that case, *PRED
    will be updated to that value.  */
 
 static bool
@@ -1913,8 +1884,7 @@ is_degenerated_phi (gimple *phi, pred_info *pred_p)
   def0 = SSA_NAME_DEF_STMT (op0);
   if (gimple_code (def0) != GIMPLE_ASSIGN)
     return false;
-  if (TREE_CODE_CLASS (gimple_assign_rhs_code (def0))
-      != tcc_comparison)
+  if (TREE_CODE_CLASS (gimple_assign_rhs_code (def0)) != tcc_comparison)
     return false;
   pred0 = get_pred_info_from_cmp (def0);
 
@@ -1930,8 +1900,7 @@ is_degenerated_phi (gimple *phi, pred_info *pred_p)
       def = SSA_NAME_DEF_STMT (op);
       if (gimple_code (def) != GIMPLE_ASSIGN)
 	return false;
-      if (TREE_CODE_CLASS (gimple_assign_rhs_code (def))
-	  != tcc_comparison)
+      if (TREE_CODE_CLASS (gimple_assign_rhs_code (def)) != tcc_comparison)
 	return false;
       pred = get_pred_info_from_cmp (def);
       if (!pred_equal_p (pred, pred0))
@@ -1969,13 +1938,12 @@ normalize_one_pred_1 (pred_chain_union *norm_preds,
   if (gimple_code (def_stmt) == GIMPLE_PHI
       && is_degenerated_phi (def_stmt, &pred))
     work_list->safe_push (pred);
-  else if (gimple_code (def_stmt) == GIMPLE_PHI
-	   && and_or_code == BIT_IOR_EXPR)
+  else if (gimple_code (def_stmt) == GIMPLE_PHI && and_or_code == BIT_IOR_EXPR)
     {
       int i, n;
       n = gimple_phi_num_args (def_stmt);
 
-      /* If we see non zero constant, we should punt. The predicate
+      /* If we see non zero constant, we should punt.  The predicate
        * should be one guarding the phi edge.  */
       for (i = 0; i < n; ++i)
 	{
@@ -2046,8 +2014,7 @@ normalize_one_pred_1 (pred_chain_union *norm_preds,
 /* Normalize PRED and store the normalized predicates into NORM_PREDS.  */
 
 static void
-normalize_one_pred (pred_chain_union *norm_preds,
-		    pred_info pred)
+normalize_one_pred (pred_chain_union *norm_preds, pred_info pred)
 {
   vec<pred_info, va_heap, vl_ptr> work_list = vNULL;
   enum tree_code and_or_code = ERROR_MARK;
@@ -2062,17 +2029,15 @@ normalize_one_pred (pred_chain_union *norm_preds,
   gimple *def_stmt = SSA_NAME_DEF_STMT (pred.pred_lhs);
   if (gimple_code (def_stmt) == GIMPLE_ASSIGN)
     and_or_code = gimple_assign_rhs_code (def_stmt);
-  if (and_or_code != BIT_IOR_EXPR
-      && and_or_code != BIT_AND_EXPR)
+  if (and_or_code != BIT_IOR_EXPR && and_or_code != BIT_AND_EXPR)
     {
-      if (TREE_CODE_CLASS (and_or_code)
-	  == tcc_comparison)
+      if (TREE_CODE_CLASS (and_or_code) == tcc_comparison)
 	{
 	  pred_info n_pred = get_pred_info_from_cmp (def_stmt);
 	  push_pred (norm_preds, n_pred);
 	}
-       else
-	  push_pred (norm_preds, pred);
+      else
+	push_pred (norm_preds, pred);
       return;
     }
 
@@ -2082,8 +2047,8 @@ normalize_one_pred (pred_chain_union *norm_preds,
   while (!work_list.is_empty ())
     {
       pred_info a_pred = work_list.pop ();
-      normalize_one_pred_1 (norm_preds, &norm_chain, a_pred,
-			    and_or_code, &work_list, &mark_set);
+      normalize_one_pred_1 (norm_preds, &norm_chain, a_pred, and_or_code,
+			    &work_list, &mark_set);
     }
   if (and_or_code == BIT_AND_EXPR)
     norm_preds->safe_push (norm_chain);
@@ -2092,8 +2057,7 @@ normalize_one_pred (pred_chain_union *norm_preds,
 }
 
 static void
-normalize_one_pred_chain (pred_chain_union *norm_preds,
-			  pred_chain one_chain)
+normalize_one_pred_chain (pred_chain_union *norm_preds, pred_chain one_chain)
 {
   vec<pred_info, va_heap, vl_ptr> work_list = vNULL;
   hash_set<tree> mark_set;
@@ -2109,8 +2073,8 @@ normalize_one_pred_chain (pred_chain_union *norm_preds,
   while (!work_list.is_empty ())
     {
       pred_info a_pred = work_list.pop ();
-      normalize_one_pred_1 (0, &norm_chain, a_pred,
-			    BIT_AND_EXPR, &work_list, &mark_set);
+      normalize_one_pred_1 (0, &norm_chain, a_pred, BIT_AND_EXPR, &work_list,
+			    &mark_set);
     }
 
   norm_preds->safe_push (norm_chain);
@@ -2146,26 +2110,26 @@ normalize_preds (pred_chain_union preds, gimple *use_or_def, bool is_use)
   if (dump_file)
     {
       fprintf (dump_file, "[AFTER NORMALIZATION -- ");
-      dump_predicates (use_or_def, norm_preds, is_use ? "[USE]:\n" : "[DEF]:\n");
+      dump_predicates (use_or_def, norm_preds,
+		       is_use ? "[USE]:\n" : "[DEF]:\n");
     }
 
   destroy_predicate_vecs (&preds);
   return norm_preds;
 }
 
-
 /* Computes the predicates that guard the use and checks
    if the incoming paths that have empty (or possibly
-   empty) definition can be pruned/filtered. The function returns
+   empty) definition can be pruned/filtered.  The function returns
    true if it can be determined that the use of PHI's def in
    USE_STMT is guarded with a predicate set not overlapping with
    predicate sets of all runtime paths that do not have a definition.
 
-   Returns false if it is not or it can not be determined. USE_BB is
+   Returns false if it is not or it can not be determined.  USE_BB is
    the bb of the use (for phi operand use, the bb is not the bb of
    the phi stmt, but the src bb of the operand edge).
 
-   UNINIT_OPNDS is a bit vector. If an operand of PHI is uninitialized, the
+   UNINIT_OPNDS is a bit vector.  If an operand of PHI is uninitialized, the
    corresponding bit in the vector is 1.  VISITED_PHIS is a pointer
    set of phis being visited.
 
@@ -2204,7 +2168,7 @@ is_use_properly_guarded (gimple *use_stmt,
       return false;
     }
 
-  /* Try to prune the dead incoming phi edges. */
+  /* Try to prune the dead incoming phi edges.  */
   is_properly_guarded
     = use_pred_not_overlap_with_undef_path_pred (preds, phi, uninit_opnds,
 						 visited_phis);
@@ -2240,11 +2204,11 @@ is_use_properly_guarded (gimple *use_stmt,
 
 /* Searches through all uses of a potentially
    uninitialized variable defined by PHI and returns a use
-   statement if the use is not properly guarded. It returns
-   NULL if all uses are guarded. UNINIT_OPNDS is a bitvector
-   holding the position(s) of uninit PHI operands. WORKLIST
+   statement if the use is not properly guarded.  It returns
+   NULL if all uses are guarded.  UNINIT_OPNDS is a bitvector
+   holding the position(s) of uninit PHI operands.  WORKLIST
    is the vector of candidate phis that may be updated by this
-   function. ADDED_TO_WORKLIST is the pointer set tracking
+   function.  ADDED_TO_WORKLIST is the pointer set tracking
    if the new phi is already in the worklist.  */
 
 static gimple *
@@ -2269,9 +2233,9 @@ find_uninit_use (gphi *phi, unsigned uninit_opnds,
       if (is_gimple_debug (use_stmt))
 	continue;
 
-      if (gphi *use_phi = dyn_cast <gphi *> (use_stmt))
-	use_bb = gimple_phi_arg_edge (use_phi,
-				      PHI_ARG_INDEX_FROM_USE (use_p))->src;
+      if (gphi *use_phi = dyn_cast<gphi *> (use_stmt))
+	use_bb
+	  = gimple_phi_arg_edge (use_phi, PHI_ARG_INDEX_FROM_USE (use_p))->src;
       else
 	use_bb = gimple_bb (use_stmt);
 
@@ -2294,7 +2258,7 @@ find_uninit_use (gphi *phi, unsigned uninit_opnds,
 
       /* Found a phi use that is not guarded,
 	 add the phi to the worklist.  */
-      if (!added_to_worklist->add (as_a <gphi *> (use_stmt)))
+      if (!added_to_worklist->add (as_a<gphi *> (use_stmt)))
 	{
 	  if (dump_file && (dump_flags & TDF_DETAILS))
 	    {
@@ -2302,7 +2266,7 @@ find_uninit_use (gphi *phi, unsigned uninit_opnds,
 	      print_gimple_stmt (dump_file, use_stmt, 0, 0);
 	    }
 
-	  worklist->safe_push (as_a <gphi *> (use_stmt));
+	  worklist->safe_push (as_a<gphi *> (use_stmt));
 	  possibly_undefined_names->add (phi_result);
 	}
     }
@@ -2313,10 +2277,10 @@ find_uninit_use (gphi *phi, unsigned uninit_opnds,
 
 /* Look for inputs to PHI that are SSA_NAMEs that have empty definitions
    and gives warning if there exists a runtime path from the entry to a
-   use of the PHI def that does not contain a definition. In other words,
-   the warning is on the real use. The more dead paths that can be pruned
-   by the compiler, the fewer false positives the warning is. WORKLIST
-   is a vector of candidate phis to be examined. ADDED_TO_WORKLIST is
+   use of the PHI def that does not contain a definition.  In other words,
+   the warning is on the real use.  The more dead paths that can be pruned
+   by the compiler, the fewer false positives the warning is.  WORKLIST
+   is a vector of candidate phis to be examined.  ADDED_TO_WORKLIST is
    a pointer set tracking if the new phi is added to the worklist or not.  */
 
 static void
@@ -2335,7 +2299,7 @@ warn_uninitialized_phi (gphi *phi, vec<gphi *> *worklist,
 
   uninit_opnds = compute_uninit_opnds_pos (phi);
 
-  if  (MASK_EMPTY (uninit_opnds))
+  if (MASK_EMPTY (uninit_opnds))
     return;
 
   if (dump_file && (dump_flags & TDF_DETAILS))
@@ -2345,8 +2309,8 @@ warn_uninitialized_phi (gphi *phi, vec<gphi *> *worklist,
     }
 
   /* Now check if we have any use of the value without proper guard.  */
-  uninit_use_stmt = find_uninit_use (phi, uninit_opnds,
-				     worklist, added_to_worklist);
+  uninit_use_stmt
+    = find_uninit_use (phi, uninit_opnds, worklist, added_to_worklist);
 
   /* All uses are properly guarded.  */
   if (!uninit_use_stmt)
@@ -2364,7 +2328,6 @@ warn_uninitialized_phi (gphi *phi, vec<gphi *> *worklist,
 	       SSA_NAME_VAR (uninit_op),
 	       "%qD may be used uninitialized in this function",
 	       uninit_use_stmt, loc);
-
 }
 
 static bool
@@ -2377,15 +2340,15 @@ namespace {
 
 const pass_data pass_data_late_warn_uninitialized =
 {
-  GIMPLE_PASS, /* type */
-  "uninit", /* name */
+  GIMPLE_PASS,   /* type */
+  "uninit",      /* name */
   OPTGROUP_NONE, /* optinfo_flags */
-  TV_NONE, /* tv_id */
-  PROP_ssa, /* properties_required */
-  0, /* properties_provided */
-  0, /* properties_destroyed */
-  0, /* todo_flags_start */
-  0, /* todo_flags_finish */
+  TV_NONE,       /* tv_id */
+  PROP_ssa,      /* properties_required */
+  0,		 /* properties_provided */
+  0,		 /* properties_destroyed */
+  0,		 /* todo_flags_start */
+  0,		 /* todo_flags_finish */
 };
 
 class pass_late_warn_uninitialized : public gimple_opt_pass
@@ -2396,12 +2359,24 @@ public:
   {}
 
   /* opt_pass methods: */
-  opt_pass * clone () { return new pass_late_warn_uninitialized (m_ctxt); }
-  virtual bool gate (function *) { return gate_warn_uninitialized (); }
+  opt_pass *clone ();
+  virtual bool gate (function *);
   virtual unsigned int execute (function *);
 
 }; // class pass_late_warn_uninitialized
 
+opt_pass *
+pass_late_warn_uninitialized::clone ()
+{
+  return new pass_late_warn_uninitialized (m_ctxt);
+}
+
+bool
+pass_late_warn_uninitialized::gate (function *)
+{
+  return gate_warn_uninitialized ();
+}
+
 unsigned int
 pass_late_warn_uninitialized::execute (function *fun)
 {
@@ -2437,8 +2412,7 @@ pass_late_warn_uninitialized::execute (function *fun)
 	for (i = 0; i < n; ++i)
 	  {
 	    tree op = gimple_phi_arg_def (phi, i);
-	    if (TREE_CODE (op) == SSA_NAME
-		&& uninit_undefined_value_p (op))
+	    if (TREE_CODE (op) == SSA_NAME && uninit_undefined_value_p (op))
 	      {
 		worklist.safe_push (phi);
 		added_to_worklist.add (phi);
@@ -2475,12 +2449,11 @@ make_pass_late_warn_uninitialized (gcc::context *ctxt)
   return new pass_late_warn_uninitialized (ctxt);
 }
 
-
 static unsigned int
 execute_early_warn_uninitialized (void)
 {
   /* Currently, this pass runs always but
-     execute_late_warn_uninitialized only runs with optimization. With
+     execute_late_warn_uninitialized only runs with optimization.  With
      optimization we want to warn about possible uninitialized as late
      as possible, thus don't do it here.  However, without
      optimization we need to warn here about "may be uninitialized".  */
@@ -2488,27 +2461,26 @@ execute_early_warn_uninitialized (void)
 
   warn_uninitialized_vars (/*warn_possibly_uninitialized=*/!optimize);
 
-  /* Post-dominator information can not be reliably updated. Free it
+  /* Post-dominator information can not be reliably updated.  Free it
      after the use.  */
 
   free_dominance_info (CDI_POST_DOMINATORS);
   return 0;
 }
 
-
 namespace {
 
 const pass_data pass_data_early_warn_uninitialized =
 {
-  GIMPLE_PASS, /* type */
+  GIMPLE_PASS,		       /* type */
   "*early_warn_uninitialized", /* name */
-  OPTGROUP_NONE, /* optinfo_flags */
-  TV_TREE_UNINIT, /* tv_id */
-  PROP_ssa, /* properties_required */
-  0, /* properties_provided */
-  0, /* properties_destroyed */
-  0, /* todo_flags_start */
-  0, /* todo_flags_finish */
+  OPTGROUP_NONE,	       /* optinfo_flags */
+  TV_TREE_UNINIT,	       /* tv_id */
+  PROP_ssa,		       /* properties_required */
+  0,			       /* properties_provided */
+  0,			       /* properties_destroyed */
+  0,			       /* todo_flags_start */
+  0,			       /* todo_flags_finish */
 };
 
 class pass_early_warn_uninitialized : public gimple_opt_pass
@@ -2519,14 +2491,23 @@ public:
   {}
 
   /* opt_pass methods: */
-  virtual bool gate (function *) { return gate_warn_uninitialized (); }
-  virtual unsigned int execute (function *)
-    {
-      return execute_early_warn_uninitialized ();
-    }
+  virtual bool gate (function *);
+  virtual unsigned int execute (function *);
 
 }; // class pass_early_warn_uninitialized
 
+bool
+pass_early_warn_uninitialized::gate (function *)
+{
+  return gate_warn_uninitialized ();
+}
+
+unsigned int
+pass_early_warn_uninitialized::execute (function *)
+{
+  return execute_early_warn_uninitialized ();
+}
+
 } // anon namespace
 
 gimple_opt_pass *
-- 
2.6.3


^ permalink raw reply	[flat|nested] 42+ messages in thread

* Re: [PATCH] Fix memory leaks in tree-ssa-uninit.c
  2015-11-19 13:58               ` Bernd Schmidt
  2015-11-19 14:57                 ` Martin Liška
@ 2015-11-19 17:34                 ` Jeff Law
  1 sibling, 0 replies; 42+ messages in thread
From: Jeff Law @ 2015-11-19 17:34 UTC (permalink / raw)
  To: Bernd Schmidt, Martin Liška, gcc-patches, joseph

On 11/19/2015 06:58 AM, Bernd Schmidt wrote:
> On 11/19/2015 11:16 AM, Martin Liška wrote:
>> You are right, however as the original coding style was really broken,
>> it was much easier
>> to use the tool and clean-up fall-out.
>>
>> Waiting for thoughts related to v2.
>
> Better, but still some oddities. I hope you won't get mad at me if I
> suggest doing this in stages? A first patch could just deal with
> non-reformatting whitespace changes, such as removing trailing
> whitespace, and converting leading spaces to tabs - that would be
> mechanical, and reduce the size of the rest of the patch (it seems emacs
> has an appropriate command, M-x whitespace-cleanup). Such a change is
> preapproved.
I was going to suggest the same after seeing the fallout.  Trailing 
whitespace and tabs/spaces sanity first.  Those are easy to verify as 
well using diff -b.  Then follow-up with others.

I don't mind gating this in, but we're probably very close to a point 
where this kind of change will need to wait for the next stage1.

Jeff

^ permalink raw reply	[flat|nested] 42+ messages in thread

* Re: [PATCH] Fix memory leaks in tree-ssa-uninit.c
  2015-11-19 14:57                 ` Martin Liška
@ 2015-11-20  2:14                   ` Bernd Schmidt
  2015-11-20 11:15                     ` Martin Liška
  0 siblings, 1 reply; 42+ messages in thread
From: Bernd Schmidt @ 2015-11-20  2:14 UTC (permalink / raw)
  To: Martin Liška, gcc-patches, joseph

BTW, I'm with whoever said absolutely no way to the idea of making 
automatic changes like this as part of a commit hook.

I think the whitespace change can go in if it hasn't already, but I 
think the other one still has enough problems that I'll say - leave it 
for the next stage 1.

> @@ -178,8 +173,9 @@ warn_uninitialized_vars (bool warn_possibly_uninitialized)
>
>    FOR_EACH_BB_FN (bb, cfun)
>      {
> -      bool always_executed = dominated_by_p (CDI_POST_DOMINATORS,
> -					     single_succ (ENTRY_BLOCK_PTR_FOR_FN (cfun)), bb);
> +      bool always_executed
> +	= dominated_by_p (CDI_POST_DOMINATORS,
> +			  single_succ (ENTRY_BLOCK_PTR_FOR_FN (cfun)), bb);
>        for (gsi = gsi_start_bb (bb); !gsi_end_p (gsi); gsi_next (&gsi))
>  	{

Better to pull the single_succ into its own variable perhaps?

> @@ -1057,7 +1039,8 @@ prune_uninit_phi_opnds_in_unrealizable_paths (gphi *phi,
>   	    *visited_flag_phis = BITMAP_ALLOC (NULL);
>
>   	  if (bitmap_bit_p (*visited_flag_phis,
> -			    SSA_NAME_VERSION (gimple_phi_result (flag_arg_def))))
> +			    SSA_NAME_VERSION (
> +			      gimple_phi_result (flag_arg_def))))
>   	    return false;
>
>   	  bitmap_set_bit (*visited_flag_phis,

Pull the gimple_phi_result into a separate variable, or just leave it 
unchanged for now, the modified version is too ugly to live.

>   	  bitmap_clear_bit (*visited_flag_phis,
> -			    SSA_NAME_VERSION (gimple_phi_result (flag_arg_def)));
> +			    SSA_NAME_VERSION (
> +			      gimple_phi_result (flag_arg_def)));
>   	  continue;
>   	}

Here too.

> -  all_pruned = prune_uninit_phi_opnds_in_unrealizable_paths (phi,
> -							     uninit_opnds,
> -							     as_a <gphi *> (flag_def),
> -							     boundary_cst,
> -							     cmp_code,
> -							     visited_phis,
> -							     &visited_flag_phis);
> +  all_pruned = prune_uninit_phi_opnds_in_unrealizable_paths
> +    (phi, uninit_opnds, as_a<gphi *> (flag_def), boundary_cst, cmp_code,
> +     visited_phis, &visited_flag_phis);

I'd rather shorten the name of the function, even if it goes against the 
spirit of the novel writing month.

> -      if (gphi *use_phi = dyn_cast <gphi *> (use_stmt))
> -	use_bb = gimple_phi_arg_edge (use_phi,
> -				      PHI_ARG_INDEX_FROM_USE (use_p))->src;
> +      if (gphi *use_phi = dyn_cast<gphi *> (use_stmt))
> +	use_bb
> +	  = gimple_phi_arg_edge (use_phi, PHI_ARG_INDEX_FROM_USE (use_p))->src;
>         else
>   	use_bb = gimple_bb (use_stmt);

There are some changes of this nature and I'm not sure it's an 
improvement. Leave them out for now?

> @@ -2345,8 +2309,8 @@ warn_uninitialized_phi (gphi *phi, vec<gphi *> *worklist,
>       }
>
>     /* Now check if we have any use of the value without proper guard.  */
> -  uninit_use_stmt = find_uninit_use (phi, uninit_opnds,
> -				     worklist, added_to_worklist);
> +  uninit_use_stmt
> +    = find_uninit_use (phi, uninit_opnds, worklist, added_to_worklist);
>
>     /* All uses are properly guarded.  */
>     if (!uninit_use_stmt)

Here too.

> @@ -2396,12 +2359,24 @@ public:
>     {}
>
>     /* opt_pass methods: */
> -  opt_pass * clone () { return new pass_late_warn_uninitialized (m_ctxt); }
> -  virtual bool gate (function *) { return gate_warn_uninitialized (); }
> +  opt_pass *clone ();
> +  virtual bool gate (function *);

This may technically violate our coding standards, but it's consistent 
with a lot of similar cases. Since coding standards are about enforcing 
consistency, I'd drop this change.

>   namespace {
>
>   const pass_data pass_data_early_warn_uninitialized =
>   {
> -  GIMPLE_PASS, /* type */
> +  GIMPLE_PASS,		       /* type */
>     "*early_warn_uninitialized", /* name */
> -  OPTGROUP_NONE, /* optinfo_flags */
> -  TV_TREE_UNINIT, /* tv_id */
> -  PROP_ssa, /* properties_required */
> -  0, /* properties_provided */
> -  0, /* properties_destroyed */
> -  0, /* todo_flags_start */
> -  0, /* todo_flags_finish */
> +  OPTGROUP_NONE,	       /* optinfo_flags */
> +  TV_TREE_UNINIT,	       /* tv_id */
> +  PROP_ssa,		       /* properties_required */
> +  0,			       /* properties_provided */
> +  0,			       /* properties_destroyed */
> +  0,			       /* todo_flags_start */
> +  0,			       /* todo_flags_finish */
>   };

Likewise. Seems to be done practically nowhere.

>   class pass_early_warn_uninitialized : public gimple_opt_pass
> @@ -2519,14 +2491,23 @@ public:
>     {}
>
>     /* opt_pass methods: */
> -  virtual bool gate (function *) { return gate_warn_uninitialized (); }
> -  virtual unsigned int execute (function *)
> -    {
> -      return execute_early_warn_uninitialized ();
> -    }
> +  virtual bool gate (function *);
> +  virtual unsigned int execute (function *);

Likewise.


Bernd

^ permalink raw reply	[flat|nested] 42+ messages in thread

* Re: [PATCH] Fix memory leaks in tree-ssa-uninit.c
  2015-11-20  2:14                   ` Bernd Schmidt
@ 2015-11-20 11:15                     ` Martin Liška
  2015-11-26 20:59                       ` Martin Liška
  0 siblings, 1 reply; 42+ messages in thread
From: Martin Liška @ 2015-11-20 11:15 UTC (permalink / raw)
  To: gcc-patches

[-- Attachment #1: Type: text/plain, Size: 5333 bytes --]

On 11/20/2015 03:14 AM, Bernd Schmidt wrote:
> BTW, I'm with whoever said absolutely no way to the idea of making automatic changes like this as part of a commit hook.
> 
> I think the whitespace change can go in if it hasn't already, but I think the other one still has enough problems that I'll say - leave it for the next stage 1.
> 
>> @@ -178,8 +173,9 @@ warn_uninitialized_vars (bool warn_possibly_uninitialized)
>>
>>    FOR_EACH_BB_FN (bb, cfun)
>>      {
>> -      bool always_executed = dominated_by_p (CDI_POST_DOMINATORS,
>> -                         single_succ (ENTRY_BLOCK_PTR_FOR_FN (cfun)), bb);
>> +      bool always_executed
>> +    = dominated_by_p (CDI_POST_DOMINATORS,
>> +              single_succ (ENTRY_BLOCK_PTR_FOR_FN (cfun)), bb);
>>        for (gsi = gsi_start_bb (bb); !gsi_end_p (gsi); gsi_next (&gsi))
>>      {
> 
> Better to pull the single_succ into its own variable perhaps?
> 
>> @@ -1057,7 +1039,8 @@ prune_uninit_phi_opnds_in_unrealizable_paths (gphi *phi,
>>           *visited_flag_phis = BITMAP_ALLOC (NULL);
>>
>>         if (bitmap_bit_p (*visited_flag_phis,
>> -                SSA_NAME_VERSION (gimple_phi_result (flag_arg_def))))
>> +                SSA_NAME_VERSION (
>> +                  gimple_phi_result (flag_arg_def))))
>>           return false;
>>
>>         bitmap_set_bit (*visited_flag_phis,
> 
> Pull the gimple_phi_result into a separate variable, or just leave it unchanged for now, the modified version is too ugly to live.
> 
>>         bitmap_clear_bit (*visited_flag_phis,
>> -                SSA_NAME_VERSION (gimple_phi_result (flag_arg_def)));
>> +                SSA_NAME_VERSION (
>> +                  gimple_phi_result (flag_arg_def)));
>>         continue;
>>       }
> 
> Here too.
> 
>> -  all_pruned = prune_uninit_phi_opnds_in_unrealizable_paths (phi,
>> -                                 uninit_opnds,
>> -                                 as_a <gphi *> (flag_def),
>> -                                 boundary_cst,
>> -                                 cmp_code,
>> -                                 visited_phis,
>> -                                 &visited_flag_phis);
>> +  all_pruned = prune_uninit_phi_opnds_in_unrealizable_paths
>> +    (phi, uninit_opnds, as_a<gphi *> (flag_def), boundary_cst, cmp_code,
>> +     visited_phis, &visited_flag_phis);
> 
> I'd rather shorten the name of the function, even if it goes against the spirit of the novel writing month.
> 
>> -      if (gphi *use_phi = dyn_cast <gphi *> (use_stmt))
>> -    use_bb = gimple_phi_arg_edge (use_phi,
>> -                      PHI_ARG_INDEX_FROM_USE (use_p))->src;
>> +      if (gphi *use_phi = dyn_cast<gphi *> (use_stmt))
>> +    use_bb
>> +      = gimple_phi_arg_edge (use_phi, PHI_ARG_INDEX_FROM_USE (use_p))->src;
>>         else
>>       use_bb = gimple_bb (use_stmt);
> 
> There are some changes of this nature and I'm not sure it's an improvement. Leave them out for now?
> 
>> @@ -2345,8 +2309,8 @@ warn_uninitialized_phi (gphi *phi, vec<gphi *> *worklist,
>>       }
>>
>>     /* Now check if we have any use of the value without proper guard.  */
>> -  uninit_use_stmt = find_uninit_use (phi, uninit_opnds,
>> -                     worklist, added_to_worklist);
>> +  uninit_use_stmt
>> +    = find_uninit_use (phi, uninit_opnds, worklist, added_to_worklist);
>>
>>     /* All uses are properly guarded.  */
>>     if (!uninit_use_stmt)
> 
> Here too.
> 
>> @@ -2396,12 +2359,24 @@ public:
>>     {}
>>
>>     /* opt_pass methods: */
>> -  opt_pass * clone () { return new pass_late_warn_uninitialized (m_ctxt); }
>> -  virtual bool gate (function *) { return gate_warn_uninitialized (); }
>> +  opt_pass *clone ();
>> +  virtual bool gate (function *);
> 
> This may technically violate our coding standards, but it's consistent with a lot of similar cases. Since coding standards are about enforcing consistency, I'd drop this change.
> 
>>   namespace {
>>
>>   const pass_data pass_data_early_warn_uninitialized =
>>   {
>> -  GIMPLE_PASS, /* type */
>> +  GIMPLE_PASS,               /* type */
>>     "*early_warn_uninitialized", /* name */
>> -  OPTGROUP_NONE, /* optinfo_flags */
>> -  TV_TREE_UNINIT, /* tv_id */
>> -  PROP_ssa, /* properties_required */
>> -  0, /* properties_provided */
>> -  0, /* properties_destroyed */
>> -  0, /* todo_flags_start */
>> -  0, /* todo_flags_finish */
>> +  OPTGROUP_NONE,           /* optinfo_flags */
>> +  TV_TREE_UNINIT,           /* tv_id */
>> +  PROP_ssa,               /* properties_required */
>> +  0,                   /* properties_provided */
>> +  0,                   /* properties_destroyed */
>> +  0,                   /* todo_flags_start */
>> +  0,                   /* todo_flags_finish */
>>   };
> 
> Likewise. Seems to be done practically nowhere.
> 
>>   class pass_early_warn_uninitialized : public gimple_opt_pass
>> @@ -2519,14 +2491,23 @@ public:
>>     {}
>>
>>     /* opt_pass methods: */
>> -  virtual bool gate (function *) { return gate_warn_uninitialized (); }
>> -  virtual unsigned int execute (function *)
>> -    {
>> -      return execute_early_warn_uninitialized ();
>> -    }
>> +  virtual bool gate (function *);
>> +  virtual unsigned int execute (function *);
> 
> Likewise.
> 
> 
> Bernd

Hi.

Enhanced patch should cover all notes pointed in the previous email.

Martin

[-- Attachment #2: 0001-Manual-changes-to-GCC-coding-style-in-tree-ssa-unini.patch --]
[-- Type: text/x-patch, Size: 40923 bytes --]

From 2d1cf483b211f07aa5cacc5e5f02a1b47ce3b4e8 Mon Sep 17 00:00:00 2001
From: marxin <mliska@suse.cz>
Date: Thu, 19 Nov 2015 15:44:47 +0100
Subject: [PATCH] Manual changes to GCC coding style in tree-ssa-uninit.c

gcc/ChangeLog:

2015-11-19  Martin Liska  <mliska@suse.cz>

	* tree-ssa-uninit.c: Apply manual changes
	to the GNU coding style.
	(prune_uninit_phi_opnds): Rename from
	prune_uninit_phi_opnds_in_unrealizable_paths.
---
 gcc/tree-ssa-uninit.c | 410 ++++++++++++++++++++++----------------------------
 1 file changed, 182 insertions(+), 228 deletions(-)

diff --git a/gcc/tree-ssa-uninit.c b/gcc/tree-ssa-uninit.c
index 50bfb03..dbbb8e9 100644
--- a/gcc/tree-ssa-uninit.c
+++ b/gcc/tree-ssa-uninit.c
@@ -35,16 +35,15 @@ along with GCC; see the file COPYING3.  If not see
 #include "tree-cfg.h"
 
 /* This implements the pass that does predicate aware warning on uses of
-   possibly uninitialized variables. The pass first collects the set of
-   possibly uninitialized SSA names. For each such name, it walks through
-   all its immediate uses. For each immediate use, it rebuilds the condition
-   expression (the predicate) that guards the use. The predicate is then
+   possibly uninitialized variables.  The pass first collects the set of
+   possibly uninitialized SSA names.  For each such name, it walks through
+   all its immediate uses.  For each immediate use, it rebuilds the condition
+   expression (the predicate) that guards the use.  The predicate is then
    examined to see if the variable is always defined under that same condition.
    This is done either by pruning the unrealizable paths that lead to the
    default definitions or by checking if the predicate set that guards the
    defining paths is a superset of the use predicate.  */
 
-
 /* Pointer set of potentially undefined ssa names, i.e.,
    ssa names that are defined by phi with operands that
    are not defined or potentially undefined.  */
@@ -56,7 +55,7 @@ static hash_set<tree> *possibly_undefined_names = 0;
 #define MASK_EMPTY(mask) (mask == 0)
 
 /* Returns the first bit position (starting from LSB)
-   in mask that is non zero. Returns -1 if the mask is empty.  */
+   in mask that is non zero.  Returns -1 if the mask is empty.  */
 static int
 get_mask_first_set_bit (unsigned mask)
 {
@@ -80,13 +79,12 @@ has_undefined_value_p (tree t)
 	      && possibly_undefined_names->contains (t)));
 }
 
-
-
 /* Like has_undefined_value_p, but don't return true if TREE_NO_WARNING
    is set on SSA_NAME_VAR.  */
 
 static inline bool
-uninit_undefined_value_p (tree t) {
+uninit_undefined_value_p (tree t)
+{
   if (!has_undefined_value_p (t))
     return false;
   if (SSA_NAME_VAR (t) && TREE_NO_WARNING (SSA_NAME_VAR (t)))
@@ -112,7 +110,7 @@ uninit_undefined_value_p (tree t) {
 /* Emit a warning for EXPR based on variable VAR at the point in the
    program T, an SSA_NAME, is used being uninitialized.  The exact
    warning text is in MSGID and DATA is the gimple stmt with info about
-   the location in source code. When DATA is a GIMPLE_PHI, PHIARG_IDX
+   the location in source code.  When DATA is a GIMPLE_PHI, PHIARG_IDX
    gives which argument of the phi node to take the location from.  WC
    is the warning code.  */
 
@@ -149,8 +147,7 @@ warn_uninit (enum opt_code wc, tree t, tree expr, tree var,
   else
     location = DECL_SOURCE_LOCATION (var);
   location = linemap_resolve_location (line_table, location,
-				       LRK_SPELLING_LOCATION,
-				       NULL);
+				       LRK_SPELLING_LOCATION, NULL);
   cfun_loc = DECL_SOURCE_LOCATION (cfun->decl);
   xloc = expand_location (location);
   floc = expand_location (cfun_loc);
@@ -161,10 +158,8 @@ warn_uninit (enum opt_code wc, tree t, tree expr, tree var,
       if (location == DECL_SOURCE_LOCATION (var))
 	return;
       if (xloc.file != floc.file
-	  || linemap_location_before_p (line_table,
-					location, cfun_loc)
-	  || linemap_location_before_p (line_table,
-					cfun->function_end_locus,
+	  || linemap_location_before_p (line_table, location, cfun_loc)
+	  || linemap_location_before_p (line_table, cfun->function_end_locus,
 					location))
 	inform (DECL_SOURCE_LOCATION (var), "%qD was declared here", var);
     }
@@ -178,8 +173,8 @@ warn_uninitialized_vars (bool warn_possibly_uninitialized)
 
   FOR_EACH_BB_FN (bb, cfun)
     {
-      bool always_executed = dominated_by_p (CDI_POST_DOMINATORS,
-					     single_succ (ENTRY_BLOCK_PTR_FOR_FN (cfun)), bb);
+      basic_block succ = single_succ (ENTRY_BLOCK_PTR_FOR_FN (cfun));
+      bool always_executed = dominated_by_p (CDI_POST_DOMINATORS, succ, bb);
       for (gsi = gsi_start_bb (bb); !gsi_end_p (gsi); gsi_next (&gsi))
 	{
 	  gimple *stmt = gsi_stmt (gsi);
@@ -196,13 +191,13 @@ warn_uninitialized_vars (bool warn_possibly_uninitialized)
 	    {
 	      use = USE_FROM_PTR (use_p);
 	      if (always_executed)
-		warn_uninit (OPT_Wuninitialized, use,
-			     SSA_NAME_VAR (use), SSA_NAME_VAR (use),
-			     "%qD is used uninitialized in this function",
-			     stmt, UNKNOWN_LOCATION);
+		warn_uninit (OPT_Wuninitialized, use, SSA_NAME_VAR (use),
+			     SSA_NAME_VAR (use),
+			     "%qD is used uninitialized in this function", stmt,
+			     UNKNOWN_LOCATION);
 	      else if (warn_possibly_uninitialized)
-		warn_uninit (OPT_Wmaybe_uninitialized, use,
-			     SSA_NAME_VAR (use), SSA_NAME_VAR (use),
+		warn_uninit (OPT_Wmaybe_uninitialized, use, SSA_NAME_VAR (use),
+			     SSA_NAME_VAR (use),
 			     "%qD may be used uninitialized in this function",
 			     stmt, UNKNOWN_LOCATION);
 	    }
@@ -232,9 +227,8 @@ warn_uninitialized_vars (bool warn_possibly_uninitialized)
 		continue;
 
 	      if (always_executed)
-		warn_uninit (OPT_Wuninitialized, use,
-			     gimple_assign_rhs1 (stmt), base,
-			     "%qE is used uninitialized in this function",
+		warn_uninit (OPT_Wuninitialized, use, gimple_assign_rhs1 (stmt),
+			     base, "%qE is used uninitialized in this function",
 			     stmt, UNKNOWN_LOCATION);
 	      else if (warn_possibly_uninitialized)
 		warn_uninit (OPT_Wmaybe_uninitialized, use,
@@ -250,9 +244,9 @@ warn_uninitialized_vars (bool warn_possibly_uninitialized)
 
 /* Checks if the operand OPND of PHI is defined by
    another phi with one operand defined by this PHI,
-   but the rest operands are all defined. If yes,
+   but the rest operands are all defined.  If yes,
    returns true to skip this operand as being
-   redundant. Can be enhanced to be more general.  */
+   redundant.  Can be enhanced to be more general.  */
 
 static bool
 can_skip_redundant_opnd (tree opnd, gimple *phi)
@@ -318,37 +312,35 @@ compute_uninit_opnds_pos (gphi *phi)
 static inline basic_block
 find_pdom (basic_block block)
 {
-   if (block == EXIT_BLOCK_PTR_FOR_FN (cfun))
-     return EXIT_BLOCK_PTR_FOR_FN (cfun);
-   else
-     {
-       basic_block bb
-	   = get_immediate_dominator (CDI_POST_DOMINATORS, block);
-       if (! bb)
-	 return EXIT_BLOCK_PTR_FOR_FN (cfun);
-       return bb;
-     }
+  if (block == EXIT_BLOCK_PTR_FOR_FN (cfun))
+    return EXIT_BLOCK_PTR_FOR_FN (cfun);
+  else
+    {
+      basic_block bb = get_immediate_dominator (CDI_POST_DOMINATORS, block);
+      if (!bb)
+	return EXIT_BLOCK_PTR_FOR_FN (cfun);
+      return bb;
+    }
 }
 
-/* Find the immediate DOM of the specified
-   basic block BLOCK.  */
+/* Find the immediate DOM of the specified basic block BLOCK.  */
 
 static inline basic_block
 find_dom (basic_block block)
 {
-   if (block == ENTRY_BLOCK_PTR_FOR_FN (cfun))
-     return ENTRY_BLOCK_PTR_FOR_FN (cfun);
-   else
-     {
-       basic_block bb = get_immediate_dominator (CDI_DOMINATORS, block);
-       if (! bb)
-	 return ENTRY_BLOCK_PTR_FOR_FN (cfun);
-       return bb;
-     }
+  if (block == ENTRY_BLOCK_PTR_FOR_FN (cfun))
+    return ENTRY_BLOCK_PTR_FOR_FN (cfun);
+  else
+    {
+      basic_block bb = get_immediate_dominator (CDI_DOMINATORS, block);
+      if (!bb)
+	return ENTRY_BLOCK_PTR_FOR_FN (cfun);
+      return bb;
+    }
 }
 
 /* Returns true if BB1 is postdominating BB2 and BB1 is
-   not a loop exit bb. The loop exit bb check is simple and does
+   not a loop exit bb.  The loop exit bb check is simple and does
    not cover all cases.  */
 
 static bool
@@ -366,7 +358,7 @@ is_non_loop_exit_postdominating (basic_block bb1, basic_block bb2)
 /* Find the closest postdominator of a specified BB, which is control
    equivalent to BB.  */
 
-static inline  basic_block
+static inline basic_block
 find_control_equiv_block (basic_block bb)
 {
   basic_block pdom;
@@ -424,7 +416,7 @@ compute_control_dep_chain (basic_block bb, basic_block dep_bb,
   for (i = 0; i < cur_chain_len; i++)
     {
       edge e = (*cur_cd_chain)[i];
-      /* Cycle detected. */
+      /* Cycle detected.  */
       if (e->src == bb)
 	return false;
     }
@@ -454,8 +446,8 @@ compute_control_dep_chain (basic_block bb, basic_block dep_bb,
 	    }
 
 	  /* Now check if DEP_BB is indirectly control dependent on BB.  */
-	  if (compute_control_dep_chain (cd_bb, dep_bb, cd_chains,
-					 num_chains, cur_cd_chain, num_calls))
+	  if (compute_control_dep_chain (cd_bb, dep_bb, cd_chains, num_chains,
+					 cur_cd_chain, num_calls))
 	    {
 	      found_cd_chain = true;
 	      break;
@@ -463,8 +455,8 @@ compute_control_dep_chain (basic_block bb, basic_block dep_bb,
 
 	  cd_bb = find_pdom (cd_bb);
 	  post_dom_check++;
-	  if (cd_bb == EXIT_BLOCK_PTR_FOR_FN (cfun) || post_dom_check >
-	      MAX_POSTDOM_CHECK)
+	  if (cd_bb == EXIT_BLOCK_PTR_FOR_FN (cfun)
+	      || post_dom_check > MAX_POSTDOM_CHECK)
 	    break;
 	}
       cur_cd_chain->pop ();
@@ -475,7 +467,7 @@ compute_control_dep_chain (basic_block bb, basic_block dep_bb,
   return found_cd_chain;
 }
 
-/* The type to represent a simple predicate  */
+/* The type to represent a simple predicate.  */
 
 struct pred_info
 {
@@ -496,13 +488,13 @@ typedef vec<pred_info, va_heap, vl_ptr> pred_chain;
 typedef vec<pred_chain, va_heap, vl_ptr> pred_chain_union;
 
 /* Converts the chains of control dependence edges into a set of
-   predicates. A control dependence chain is represented by a vector
-   edges. DEP_CHAINS points to an array of dependence chains.
-   NUM_CHAINS is the size of the chain array. One edge in a dependence
+   predicates.  A control dependence chain is represented by a vector
+   edges.  DEP_CHAINS points to an array of dependence chains.
+   NUM_CHAINS is the size of the chain array.  One edge in a dependence
    chain is mapped to predicate expression represented by pred_info
-   type. One dependence chain is converted to a composite predicate that
+   type.  One dependence chain is converted to a composite predicate that
    is the result of AND operation of pred_info mapped to each edge.
-   A composite predicate is presented by a vector of pred_info. On
+   A composite predicate is presented by a vector of pred_info.  On
    return, *PREDS points to the resulting array of composite predicates.
    *NUM_PREDS is the number of composite predictes.  */
 
@@ -543,13 +535,9 @@ convert_control_dep_chain_into_preds (vec<edge> *dep_chains,
 	      break;
 	    }
 	  cond_stmt = gsi_stmt (gsi);
-	  if (is_gimple_call (cond_stmt)
-	      && EDGE_COUNT (e->src->succs) >= 2)
-	    {
-	      /* Ignore EH edge. Can add assertion
-		 on the other edge's flag.  */
-	      continue;
-	    }
+	  if (is_gimple_call (cond_stmt) && EDGE_COUNT (e->src->succs) >= 2)
+	    /* Ignore EH edge.  Can add assertion on the other edge's flag.  */
+	    continue;
 	  /* Skip if there is essentially one succesor.  */
 	  if (EDGE_COUNT (e->src->succs) == 2)
 	    {
@@ -577,7 +565,7 @@ convert_control_dep_chain_into_preds (vec<edge> *dep_chains,
 	      t_chain.safe_push (one_pred);
 	      has_valid_pred = true;
 	    }
-	  else if (gswitch *gs = dyn_cast <gswitch *> (cond_stmt))
+	  else if (gswitch *gs = dyn_cast<gswitch *> (cond_stmt))
 	    {
 	      /* Avoid quadratic behavior.  */
 	      if (gimple_switch_num_labels (gs) > MAX_SWITCH_CASES)
@@ -607,8 +595,8 @@ convert_control_dep_chain_into_preds (vec<edge> *dep_chains,
 		 fail.  */
 	      if (!l
 		  || !CASE_LOW (l)
-		  || (CASE_HIGH (l) && !operand_equal_p (CASE_LOW (l),
-							 CASE_HIGH (l), 0)))
+		  || (CASE_HIGH (l)
+		      && !operand_equal_p (CASE_LOW (l), CASE_HIGH (l), 0)))
 		{
 		  has_valid_pred = false;
 		  break;
@@ -635,7 +623,7 @@ convert_control_dep_chain_into_preds (vec<edge> *dep_chains,
   return has_valid_pred;
 }
 
-/* Computes all control dependence chains for USE_BB. The control
+/* Computes all control dependence chains for USE_BB.  The control
    dependence chains are then converted to an array of composite
    predicates pointed to by PREDS.  PHI_BB is the basic block of
    the phi whose result is used in USE_BB.  */
@@ -676,8 +664,8 @@ find_predicates (pred_chain_union *preds,
 
 /* Computes the set of incoming edges of PHI that have non empty
    definitions of a phi chain.  The collection will be done
-   recursively on operands that are defined by phis. CD_ROOT
-   is the control dependence root. *EDGES holds the result, and
+   recursively on operands that are defined by phis.  CD_ROOT
+   is the control dependence root.  *EDGES holds the result, and
    VISITED_PHIS is a pointer set for detecting cycles.  */
 
 static void
@@ -702,7 +690,7 @@ collect_phi_def_edges (gphi *phi, basic_block cd_root,
 	{
 	  if (dump_file && (dump_flags & TDF_DETAILS))
 	    {
-	      fprintf (dump_file, "\n[CHECK] Found def edge %d in ", (int)i);
+	      fprintf (dump_file, "\n[CHECK] Found def edge %d in ", (int) i);
 	      print_gimple_stmt (dump_file, phi, 0, 0);
 	    }
 	  edges->safe_push (opnd_edge);
@@ -712,15 +700,15 @@ collect_phi_def_edges (gphi *phi, basic_block cd_root,
 	  gimple *def = SSA_NAME_DEF_STMT (opnd);
 
 	  if (gimple_code (def) == GIMPLE_PHI
-	      && dominated_by_p (CDI_DOMINATORS,
-				 gimple_bb (def), cd_root))
-	    collect_phi_def_edges (as_a <gphi *> (def), cd_root, edges,
+	      && dominated_by_p (CDI_DOMINATORS, gimple_bb (def), cd_root))
+	    collect_phi_def_edges (as_a<gphi *> (def), cd_root, edges,
 				   visited_phis);
 	  else if (!uninit_undefined_value_p (opnd))
 	    {
 	      if (dump_file && (dump_flags & TDF_DETAILS))
 		{
-		  fprintf (dump_file, "\n[CHECK] Found def edge %d in ", (int)i);
+		  fprintf (dump_file, "\n[CHECK] Found def edge %d in ",
+			   (int) i);
 		  print_gimple_stmt (dump_file, phi, 0, 0);
 		}
 	      edges->safe_push (opnd_edge);
@@ -745,7 +733,7 @@ find_def_preds (pred_chain_union *preds, gphi *phi)
 
   phi_bb = gimple_bb (phi);
   /* First find the closest dominating bb to be
-     the control dependence root  */
+     the control dependence root.  */
   cd_root = find_dom (phi_bb);
   if (!cd_root)
     return false;
@@ -789,8 +777,7 @@ find_def_preds (pred_chain_union *preds, gphi *phi)
 /* Dumps the predicates (PREDS) for USESTMT.  */
 
 static void
-dump_predicates (gimple *usestmt, pred_chain_union preds,
-		 const char* msg)
+dump_predicates (gimple *usestmt, pred_chain_union preds, const char *msg)
 {
   size_t i, j;
   pred_chain one_pred_chain = vNULL;
@@ -839,13 +826,11 @@ destroy_predicate_vecs (pred_chain_union *preds)
   preds->release ();
 }
 
-
 /* Computes the 'normalized' conditional code with operand
    swapping and condition inversion.  */
 
 static enum tree_code
-get_cmp_code (enum tree_code orig_cmp_code,
-	      bool swap_cond, bool invert)
+get_cmp_code (enum tree_code orig_cmp_code, bool swap_cond, bool invert)
 {
   enum tree_code tc = orig_cmp_code;
 
@@ -880,14 +865,12 @@ is_value_included_in (tree val, tree boundary, enum tree_code cmpc)
   bool result;
 
   /* Only handle integer constant here.  */
-  if (TREE_CODE (val) != INTEGER_CST
-      || TREE_CODE (boundary) != INTEGER_CST)
+  if (TREE_CODE (val) != INTEGER_CST || TREE_CODE (boundary) != INTEGER_CST)
     return true;
 
   is_unsigned = TYPE_UNSIGNED (TREE_TYPE (val));
 
-  if (cmpc == GE_EXPR || cmpc == GT_EXPR
-      || cmpc == NE_EXPR)
+  if (cmpc == GE_EXPR || cmpc == GT_EXPR || cmpc == NE_EXPR)
     {
       cmpc = invert_tree_comparison (cmpc, false);
       inverted = true;
@@ -949,7 +932,7 @@ find_matching_predicate_in_rest_chains (pred_info pred,
 	{
 	  pred_info pred2 = one_chain[j];
 	  /* Can relax the condition comparison to not
-	     use address comparison. However, the most common
+	     use address comparison.  However, the most common
 	     case is that multiple control dependent paths share
 	     a common path prefix, so address comparison should
 	     be ok.  */
@@ -969,16 +952,15 @@ find_matching_predicate_in_rest_chains (pred_info pred,
 }
 
 /* Forward declaration.  */
-static bool
-is_use_properly_guarded (gimple *use_stmt,
-			 basic_block use_bb,
-			 gphi *phi,
-			 unsigned uninit_opnds,
-			 pred_chain_union *def_preds,
-			 hash_set<gphi *> *visited_phis);
-
-/* Returns true if all uninitialized opnds are pruned. Returns false
-   otherwise. PHI is the phi node with uninitialized operands,
+static bool is_use_properly_guarded (gimple *use_stmt,
+				     basic_block use_bb,
+				     gphi *phi,
+				     unsigned uninit_opnds,
+				     pred_chain_union *def_preds,
+				     hash_set<gphi *> *visited_phis);
+
+/* Returns true if all uninitialized opnds are pruned.  Returns false
+   otherwise.  PHI is the phi node with uninitialized operands,
    UNINIT_OPNDS is the bitmap of the uninitialize operand positions,
    FLAG_DEF is the statement defining the flag guarding the use of the
    PHI output, BOUNDARY_CST is the const value used in the predicate
@@ -990,7 +972,7 @@ is_use_properly_guarded (gimple *use_stmt,
    Example scenario:
 
    BB1:
-   flag_1 = phi <0, 1>		  // (1)
+   flag_1 = phi <0, 1>			// (1)
    var_1  = phi <undef, some_val>
 
 
@@ -1001,24 +983,20 @@ is_use_properly_guarded (gimple *use_stmt,
       goto BB3;
 
    BB3:
-   use of var_2			 // (3)
+   use of var_2				// (3)
 
    Because some flag arg in (1) is not constant, if we do not look into the
    flag phis recursively, it is conservatively treated as unknown and var_1
-   is thought to be flowed into use at (3). Since var_1 is potentially uninitialized
-   a false warning will be emitted. Checking recursively into (1), the compiler can
-   find out that only some_val (which is defined) can flow into (3) which is OK.
-
-*/
+   is thought to be flowed into use at (3).  Since var_1 is potentially
+   uninitialized a false warning will be emitted.
+   Checking recursively into (1), the compiler can find out that only some_val
+   (which is defined) can flow into (3) which is OK.  */
 
 static bool
-prune_uninit_phi_opnds_in_unrealizable_paths (gphi *phi,
-					      unsigned uninit_opnds,
-					      gphi *flag_def,
-					      tree boundary_cst,
-					      enum tree_code cmp_code,
-					      hash_set<gphi *> *visited_phis,
-					      bitmap *visited_flag_phis)
+prune_uninit_phi_opnds (gphi *phi, unsigned uninit_opnds, gphi *flag_def,
+			tree boundary_cst, enum tree_code cmp_code,
+			hash_set<gphi *> *visited_phis,
+			bitmap *visited_flag_phis)
 {
   unsigned i;
 
@@ -1038,7 +1016,7 @@ prune_uninit_phi_opnds_in_unrealizable_paths (gphi *phi,
 
 	  if (TREE_CODE (flag_arg) != SSA_NAME)
 	    return false;
-	  flag_arg_def = dyn_cast <gphi *> (SSA_NAME_DEF_STMT (flag_arg));
+	  flag_arg_def = dyn_cast<gphi *> (SSA_NAME_DEF_STMT (flag_arg));
 	  if (!flag_arg_def)
 	    return false;
 
@@ -1046,7 +1024,7 @@ prune_uninit_phi_opnds_in_unrealizable_paths (gphi *phi,
 	  if (TREE_CODE (phi_arg) != SSA_NAME)
 	    return false;
 
-	  phi_arg_def = dyn_cast <gphi *> (SSA_NAME_DEF_STMT (phi_arg));
+	  phi_arg_def = dyn_cast<gphi *> (SSA_NAME_DEF_STMT (phi_arg));
 	  if (!phi_arg_def)
 	    return false;
 
@@ -1056,8 +1034,8 @@ prune_uninit_phi_opnds_in_unrealizable_paths (gphi *phi,
 	  if (!*visited_flag_phis)
 	    *visited_flag_phis = BITMAP_ALLOC (NULL);
 
-	  if (bitmap_bit_p (*visited_flag_phis,
-			    SSA_NAME_VERSION (gimple_phi_result (flag_arg_def))))
+	  tree phi_result = gimple_phi_result (flag_arg_def);
+	  if (bitmap_bit_p (*visited_flag_phis, SSA_NAME_VERSION (phi_result)))
 	    return false;
 
 	  bitmap_set_bit (*visited_flag_phis,
@@ -1065,13 +1043,13 @@ prune_uninit_phi_opnds_in_unrealizable_paths (gphi *phi,
 
 	  /* Now recursively prune the uninitialized phi args.  */
 	  uninit_opnds_arg_phi = compute_uninit_opnds_pos (phi_arg_def);
-	  if (!prune_uninit_phi_opnds_in_unrealizable_paths
-		 (phi_arg_def, uninit_opnds_arg_phi, flag_arg_def,
-		  boundary_cst, cmp_code, visited_phis, visited_flag_phis))
+	  if (!prune_uninit_phi_opnds
+	      (phi_arg_def, uninit_opnds_arg_phi, flag_arg_def, boundary_cst,
+	       cmp_code, visited_phis, visited_flag_phis))
 	    return false;
 
-	  bitmap_clear_bit (*visited_flag_phis,
-			    SSA_NAME_VERSION (gimple_phi_result (flag_arg_def)));
+	  phi_result = gimple_phi_result (flag_arg_def);
+	  bitmap_clear_bit (*visited_flag_phis, SSA_NAME_VERSION (phi_result));
 	  continue;
 	}
 
@@ -1082,26 +1060,22 @@ prune_uninit_phi_opnds_in_unrealizable_paths (gphi *phi,
 	  gimple *opnd_def;
 
 	  /* Now that we know that this undefined edge is not
-	     pruned. If the operand is defined by another phi,
+	     pruned.  If the operand is defined by another phi,
 	     we can further prune the incoming edges of that
 	     phi by checking the predicates of this operands.  */
 
 	  opnd = gimple_phi_arg_def (phi, i);
 	  opnd_def = SSA_NAME_DEF_STMT (opnd);
-	  if (gphi *opnd_def_phi = dyn_cast <gphi *> (opnd_def))
+	  if (gphi *opnd_def_phi = dyn_cast<gphi *> (opnd_def))
 	    {
 	      edge opnd_edge;
-	      unsigned uninit_opnds2
-		  = compute_uninit_opnds_pos (opnd_def_phi);
+	      unsigned uninit_opnds2 = compute_uninit_opnds_pos (opnd_def_phi);
 	      pred_chain_union def_preds = vNULL;
 	      bool ok;
 	      gcc_assert (!MASK_EMPTY (uninit_opnds2));
 	      opnd_edge = gimple_phi_arg_edge (phi, i);
-	      ok = is_use_properly_guarded (phi,
-					    opnd_edge->src,
-					    opnd_def_phi,
-					    uninit_opnds2,
-					    &def_preds,
+	      ok = is_use_properly_guarded (phi, opnd_edge->src, opnd_def_phi,
+					    uninit_opnds2, &def_preds,
 					    visited_phis);
 	      destroy_predicate_vecs (&def_preds);
 	      if (!ok)
@@ -1141,11 +1115,11 @@ prune_uninit_phi_opnds_in_unrealizable_paths (gphi *phi,
 	     return true;
 	 }
 
-	 void foo(..)
+	 void foo (..)
 	 {
 	     int x;
 
-	     if (!init_func(&x))
+	     if (!init_func (&x))
 		return;
 
 	     .. some_code ...
@@ -1177,7 +1151,7 @@ prune_uninit_phi_opnds_in_unrealizable_paths (gphi *phi,
 	<==> false
 
      This implementation provides framework that can handle
-     scenarios. (Note that many simple cases are handled properly
+     scenarios.  (Note that many simple cases are handled properly
      without the predicate analysis -- this is due to jump threading
      transformation which eliminates the merge point thus makes
      path sensitive analysis unnecessary.)
@@ -1185,10 +1159,9 @@ prune_uninit_phi_opnds_in_unrealizable_paths (gphi *phi,
      NUM_PREDS is the number is the number predicate chains, PREDS is
      the array of chains, PHI is the phi node whose incoming (undefined)
      paths need to be pruned, and UNINIT_OPNDS is the bitmap holding
-     uninit operand positions. VISITED_PHIS is the pointer set of phi
+     uninit operand positions.  VISITED_PHIS is the pointer set of phi
      stmts being checked.  */
 
-
 static bool
 use_pred_not_overlap_with_undef_path_pred (pred_chain_union preds,
 					   gphi *phi, unsigned uninit_opnds,
@@ -1196,7 +1169,7 @@ use_pred_not_overlap_with_undef_path_pred (pred_chain_union preds,
 {
   unsigned int i, n;
   gimple *flag_def = 0;
-  tree  boundary_cst = 0;
+  tree boundary_cst = 0;
   enum tree_code cmp_code;
   bool swap_cond = false;
   bool invert = false;
@@ -1263,13 +1236,9 @@ use_pred_not_overlap_with_undef_path_pred (pred_chain_union preds,
   if (cmp_code == ERROR_MARK)
     return false;
 
-  all_pruned = prune_uninit_phi_opnds_in_unrealizable_paths (phi,
-							     uninit_opnds,
-							     as_a <gphi *> (flag_def),
-							     boundary_cst,
-							     cmp_code,
-							     visited_phis,
-							     &visited_flag_phis);
+  all_pruned = prune_uninit_phi_opnds
+    (phi, uninit_opnds, as_a<gphi *> (flag_def), boundary_cst, cmp_code,
+     visited_phis, &visited_flag_phis);
 
   if (visited_flag_phis)
     BITMAP_FREE (visited_flag_phis);
@@ -1278,7 +1247,7 @@ use_pred_not_overlap_with_undef_path_pred (pred_chain_union preds,
 }
 
 /* The helper function returns true if two predicates X1 and X2
-   are equivalent. It assumes the expressions have already
+   are equivalent.  It assumes the expressions have already
    properly re-associated.  */
 
 static inline bool
@@ -1305,8 +1274,8 @@ static inline bool
 is_neq_relop_p (pred_info pred)
 {
 
-  return (pred.cond_code == NE_EXPR && !pred.invert)
-	  || (pred.cond_code == EQ_EXPR && pred.invert);
+  return ((pred.cond_code == NE_EXPR && !pred.invert)
+	  || (pred.cond_code == EQ_EXPR && pred.invert));
 }
 
 /* Returns true if pred is of the form X != 0.  */
@@ -1333,7 +1302,7 @@ pred_expr_equal_p (pred_info x1, tree x2)
 }
 
 /* Returns true of the domain of single predicate expression
-   EXPR1 is a subset of that of EXPR2. Returns false if it
+   EXPR1 is a subset of that of EXPR2.  Returns false if it
    can not be proved.  */
 
 static bool
@@ -1358,8 +1327,7 @@ is_pred_expr_subset_of (pred_info expr1, pred_info expr2)
   if (expr2.invert)
     code2 = invert_tree_comparison (code2, false);
 
-  if ((code1 == EQ_EXPR || code1 == BIT_AND_EXPR)
-      && code2 == BIT_AND_EXPR)
+  if ((code1 == EQ_EXPR || code1 == BIT_AND_EXPR) && code2 == BIT_AND_EXPR)
     return wi::eq_p (expr1.pred_rhs,
 		     wi::bit_and (expr1.pred_rhs, expr2.pred_rhs));
 
@@ -1373,11 +1341,10 @@ is_pred_expr_subset_of (pred_info expr1, pred_info expr2)
 }
 
 /* Returns true if the domain of PRED1 is a subset
-   of that of PRED2. Returns false if it can not be proved so.  */
+   of that of PRED2.  Returns false if it can not be proved so.  */
 
 static bool
-is_pred_chain_subset_of (pred_chain pred1,
-			 pred_chain pred2)
+is_pred_chain_subset_of (pred_chain pred1, pred_chain pred2)
 {
   size_t np1, np2, i1, i2;
 
@@ -1405,7 +1372,7 @@ is_pred_chain_subset_of (pred_chain pred1,
 
 /* Returns true if the domain defined by
    one pred chain ONE_PRED is a subset of the domain
-   of *PREDS. It returns false if ONE_PRED's domain is
+   of *PREDS.  It returns false if ONE_PRED's domain is
    not a subset of any of the sub-domains of PREDS
    (corresponding to each individual chains in it), even
    though it may be still be a subset of whole domain
@@ -1429,15 +1396,15 @@ is_included_in (pred_chain one_pred, pred_chain_union preds)
 
 /* Compares two predicate sets PREDS1 and PREDS2 and returns
    true if the domain defined by PREDS1 is a superset
-   of PREDS2's domain. N1 and N2 are array sizes of PREDS1 and
-   PREDS2 respectively. The implementation chooses not to build
+   of PREDS2's domain.  N1 and N2 are array sizes of PREDS1 and
+   PREDS2 respectively.  The implementation chooses not to build
    generic trees (and relying on the folding capability of the
    compiler), but instead performs brute force comparison of
    individual predicate chains (won't be a compile time problem
-   as the chains are pretty short). When the function returns
+   as the chains are pretty short).  When the function returns
    false, it does not necessarily mean *PREDS1 is not a superset
    of *PREDS2, but mean it may not be so since the analysis can
-   not prove it. In such cases, false warnings may still be
+   not prove it.  In such cases, false warnings may still be
    emitted.  */
 
 static bool
@@ -1534,19 +1501,19 @@ simplify_pred (pred_chain *one_chain)
 
 	      if (pred_expr_equal_p (*b_pred, gimple_assign_rhs1 (def_stmt))
 		  || pred_expr_equal_p (*b_pred, gimple_assign_rhs2 (def_stmt)))
-		 {
-		   /* Mark a_pred for removal.  */
-		   a_pred->pred_lhs = NULL;
-		   a_pred->pred_rhs = NULL;
-		   simplified = true;
-		   break;
-		 }
+		{
+		  /* Mark a_pred for removal.  */
+		  a_pred->pred_lhs = NULL;
+		  a_pred->pred_rhs = NULL;
+		  simplified = true;
+		  break;
+		}
 	    }
 	}
     }
 
   if (!simplified)
-     return;
+    return;
 
   for (i = 0; i < n; i++)
     {
@@ -1556,8 +1523,8 @@ simplify_pred (pred_chain *one_chain)
       s_chain.safe_push (*a_pred);
     }
 
-   one_chain->release ();
-   *one_chain = s_chain;
+  one_chain->release ();
+  *one_chain = s_chain;
 }
 
 /* The helper function implements the rule 2 for the
@@ -1744,8 +1711,7 @@ simplify_preds_4 (pred_chain_union *preds)
 
 	  x2 = (*b_chain)[0];
 	  y2 = (*b_chain)[1];
-	  if (!is_neq_zero_form_p (x2)
-	      || !is_neq_zero_form_p (y2))
+	  if (!is_neq_zero_form_p (x2) || !is_neq_zero_form_p (y2))
 	    continue;
 
 	  if ((pred_expr_equal_p (x2, gimple_assign_rhs1 (def_stmt))
@@ -1778,7 +1744,6 @@ simplify_preds_4 (pred_chain_union *preds)
   return simplified;
 }
 
-
 /* This function simplifies predicates in PREDS.  */
 
 static void
@@ -1813,14 +1778,14 @@ simplify_preds (pred_chain_union *preds, gimple *use_or_def, bool is_use)
 
       if (simplify_preds_4 (preds))
 	changed = true;
-
-    } while (changed);
+    }
+  while (changed);
 
   return;
 }
 
 /* This is a helper function which attempts to normalize predicate chains
-  by following UD chains. It basically builds up a big tree of either IOR
+  by following UD chains.  It basically builds up a big tree of either IOR
   operations or AND operations, and convert the IOR tree into a
   pred_chain_union or BIT_AND tree into a pred_chain.
   Example:
@@ -1893,7 +1858,7 @@ get_pred_info_from_cmp (gimple *cmp_assign)
 }
 
 /* Returns true if the PHI is a degenerated phi with
-   all args with the same value (relop). In that case, *PRED
+   all args with the same value (relop).  In that case, *PRED
    will be updated to that value.  */
 
 static bool
@@ -1913,8 +1878,7 @@ is_degenerated_phi (gimple *phi, pred_info *pred_p)
   def0 = SSA_NAME_DEF_STMT (op0);
   if (gimple_code (def0) != GIMPLE_ASSIGN)
     return false;
-  if (TREE_CODE_CLASS (gimple_assign_rhs_code (def0))
-      != tcc_comparison)
+  if (TREE_CODE_CLASS (gimple_assign_rhs_code (def0)) != tcc_comparison)
     return false;
   pred0 = get_pred_info_from_cmp (def0);
 
@@ -1930,8 +1894,7 @@ is_degenerated_phi (gimple *phi, pred_info *pred_p)
       def = SSA_NAME_DEF_STMT (op);
       if (gimple_code (def) != GIMPLE_ASSIGN)
 	return false;
-      if (TREE_CODE_CLASS (gimple_assign_rhs_code (def))
-	  != tcc_comparison)
+      if (TREE_CODE_CLASS (gimple_assign_rhs_code (def)) != tcc_comparison)
 	return false;
       pred = get_pred_info_from_cmp (def);
       if (!pred_equal_p (pred, pred0))
@@ -1969,13 +1932,12 @@ normalize_one_pred_1 (pred_chain_union *norm_preds,
   if (gimple_code (def_stmt) == GIMPLE_PHI
       && is_degenerated_phi (def_stmt, &pred))
     work_list->safe_push (pred);
-  else if (gimple_code (def_stmt) == GIMPLE_PHI
-	   && and_or_code == BIT_IOR_EXPR)
+  else if (gimple_code (def_stmt) == GIMPLE_PHI && and_or_code == BIT_IOR_EXPR)
     {
       int i, n;
       n = gimple_phi_num_args (def_stmt);
 
-      /* If we see non zero constant, we should punt. The predicate
+      /* If we see non zero constant, we should punt.  The predicate
        * should be one guarding the phi edge.  */
       for (i = 0; i < n; ++i)
 	{
@@ -2046,8 +2008,7 @@ normalize_one_pred_1 (pred_chain_union *norm_preds,
 /* Normalize PRED and store the normalized predicates into NORM_PREDS.  */
 
 static void
-normalize_one_pred (pred_chain_union *norm_preds,
-		    pred_info pred)
+normalize_one_pred (pred_chain_union *norm_preds, pred_info pred)
 {
   vec<pred_info, va_heap, vl_ptr> work_list = vNULL;
   enum tree_code and_or_code = ERROR_MARK;
@@ -2062,17 +2023,15 @@ normalize_one_pred (pred_chain_union *norm_preds,
   gimple *def_stmt = SSA_NAME_DEF_STMT (pred.pred_lhs);
   if (gimple_code (def_stmt) == GIMPLE_ASSIGN)
     and_or_code = gimple_assign_rhs_code (def_stmt);
-  if (and_or_code != BIT_IOR_EXPR
-      && and_or_code != BIT_AND_EXPR)
+  if (and_or_code != BIT_IOR_EXPR && and_or_code != BIT_AND_EXPR)
     {
-      if (TREE_CODE_CLASS (and_or_code)
-	  == tcc_comparison)
+      if (TREE_CODE_CLASS (and_or_code) == tcc_comparison)
 	{
 	  pred_info n_pred = get_pred_info_from_cmp (def_stmt);
 	  push_pred (norm_preds, n_pred);
 	}
-       else
-	  push_pred (norm_preds, pred);
+      else
+	push_pred (norm_preds, pred);
       return;
     }
 
@@ -2082,8 +2041,8 @@ normalize_one_pred (pred_chain_union *norm_preds,
   while (!work_list.is_empty ())
     {
       pred_info a_pred = work_list.pop ();
-      normalize_one_pred_1 (norm_preds, &norm_chain, a_pred,
-			    and_or_code, &work_list, &mark_set);
+      normalize_one_pred_1 (norm_preds, &norm_chain, a_pred, and_or_code,
+			    &work_list, &mark_set);
     }
   if (and_or_code == BIT_AND_EXPR)
     norm_preds->safe_push (norm_chain);
@@ -2092,8 +2051,7 @@ normalize_one_pred (pred_chain_union *norm_preds,
 }
 
 static void
-normalize_one_pred_chain (pred_chain_union *norm_preds,
-			  pred_chain one_chain)
+normalize_one_pred_chain (pred_chain_union *norm_preds, pred_chain one_chain)
 {
   vec<pred_info, va_heap, vl_ptr> work_list = vNULL;
   hash_set<tree> mark_set;
@@ -2109,8 +2067,8 @@ normalize_one_pred_chain (pred_chain_union *norm_preds,
   while (!work_list.is_empty ())
     {
       pred_info a_pred = work_list.pop ();
-      normalize_one_pred_1 (0, &norm_chain, a_pred,
-			    BIT_AND_EXPR, &work_list, &mark_set);
+      normalize_one_pred_1 (0, &norm_chain, a_pred, BIT_AND_EXPR, &work_list,
+			    &mark_set);
     }
 
   norm_preds->safe_push (norm_chain);
@@ -2146,26 +2104,26 @@ normalize_preds (pred_chain_union preds, gimple *use_or_def, bool is_use)
   if (dump_file)
     {
       fprintf (dump_file, "[AFTER NORMALIZATION -- ");
-      dump_predicates (use_or_def, norm_preds, is_use ? "[USE]:\n" : "[DEF]:\n");
+      dump_predicates (use_or_def, norm_preds,
+		       is_use ? "[USE]:\n" : "[DEF]:\n");
     }
 
   destroy_predicate_vecs (&preds);
   return norm_preds;
 }
 
-
 /* Computes the predicates that guard the use and checks
    if the incoming paths that have empty (or possibly
-   empty) definition can be pruned/filtered. The function returns
+   empty) definition can be pruned/filtered.  The function returns
    true if it can be determined that the use of PHI's def in
    USE_STMT is guarded with a predicate set not overlapping with
    predicate sets of all runtime paths that do not have a definition.
 
-   Returns false if it is not or it can not be determined. USE_BB is
+   Returns false if it is not or it can not be determined.  USE_BB is
    the bb of the use (for phi operand use, the bb is not the bb of
    the phi stmt, but the src bb of the operand edge).
 
-   UNINIT_OPNDS is a bit vector. If an operand of PHI is uninitialized, the
+   UNINIT_OPNDS is a bit vector.  If an operand of PHI is uninitialized, the
    corresponding bit in the vector is 1.  VISITED_PHIS is a pointer
    set of phis being visited.
 
@@ -2204,7 +2162,7 @@ is_use_properly_guarded (gimple *use_stmt,
       return false;
     }
 
-  /* Try to prune the dead incoming phi edges. */
+  /* Try to prune the dead incoming phi edges.  */
   is_properly_guarded
     = use_pred_not_overlap_with_undef_path_pred (preds, phi, uninit_opnds,
 						 visited_phis);
@@ -2240,11 +2198,11 @@ is_use_properly_guarded (gimple *use_stmt,
 
 /* Searches through all uses of a potentially
    uninitialized variable defined by PHI and returns a use
-   statement if the use is not properly guarded. It returns
-   NULL if all uses are guarded. UNINIT_OPNDS is a bitvector
-   holding the position(s) of uninit PHI operands. WORKLIST
+   statement if the use is not properly guarded.  It returns
+   NULL if all uses are guarded.  UNINIT_OPNDS is a bitvector
+   holding the position(s) of uninit PHI operands.  WORKLIST
    is the vector of candidate phis that may be updated by this
-   function. ADDED_TO_WORKLIST is the pointer set tracking
+   function.  ADDED_TO_WORKLIST is the pointer set tracking
    if the new phi is already in the worklist.  */
 
 static gimple *
@@ -2269,7 +2227,7 @@ find_uninit_use (gphi *phi, unsigned uninit_opnds,
       if (is_gimple_debug (use_stmt))
 	continue;
 
-      if (gphi *use_phi = dyn_cast <gphi *> (use_stmt))
+      if (gphi *use_phi = dyn_cast<gphi *> (use_stmt))
 	use_bb = gimple_phi_arg_edge (use_phi,
 				      PHI_ARG_INDEX_FROM_USE (use_p))->src;
       else
@@ -2294,7 +2252,7 @@ find_uninit_use (gphi *phi, unsigned uninit_opnds,
 
       /* Found a phi use that is not guarded,
 	 add the phi to the worklist.  */
-      if (!added_to_worklist->add (as_a <gphi *> (use_stmt)))
+      if (!added_to_worklist->add (as_a<gphi *> (use_stmt)))
 	{
 	  if (dump_file && (dump_flags & TDF_DETAILS))
 	    {
@@ -2302,7 +2260,7 @@ find_uninit_use (gphi *phi, unsigned uninit_opnds,
 	      print_gimple_stmt (dump_file, use_stmt, 0, 0);
 	    }
 
-	  worklist->safe_push (as_a <gphi *> (use_stmt));
+	  worklist->safe_push (as_a<gphi *> (use_stmt));
 	  possibly_undefined_names->add (phi_result);
 	}
     }
@@ -2313,10 +2271,10 @@ find_uninit_use (gphi *phi, unsigned uninit_opnds,
 
 /* Look for inputs to PHI that are SSA_NAMEs that have empty definitions
    and gives warning if there exists a runtime path from the entry to a
-   use of the PHI def that does not contain a definition. In other words,
-   the warning is on the real use. The more dead paths that can be pruned
-   by the compiler, the fewer false positives the warning is. WORKLIST
-   is a vector of candidate phis to be examined. ADDED_TO_WORKLIST is
+   use of the PHI def that does not contain a definition.  In other words,
+   the warning is on the real use.  The more dead paths that can be pruned
+   by the compiler, the fewer false positives the warning is.  WORKLIST
+   is a vector of candidate phis to be examined.  ADDED_TO_WORKLIST is
    a pointer set tracking if the new phi is added to the worklist or not.  */
 
 static void
@@ -2335,7 +2293,7 @@ warn_uninitialized_phi (gphi *phi, vec<gphi *> *worklist,
 
   uninit_opnds = compute_uninit_opnds_pos (phi);
 
-  if  (MASK_EMPTY (uninit_opnds))
+  if (MASK_EMPTY (uninit_opnds))
     return;
 
   if (dump_file && (dump_flags & TDF_DETAILS))
@@ -2364,7 +2322,6 @@ warn_uninitialized_phi (gphi *phi, vec<gphi *> *worklist,
 	       SSA_NAME_VAR (uninit_op),
 	       "%qD may be used uninitialized in this function",
 	       uninit_use_stmt, loc);
-
 }
 
 static bool
@@ -2396,7 +2353,7 @@ public:
   {}
 
   /* opt_pass methods: */
-  opt_pass * clone () { return new pass_late_warn_uninitialized (m_ctxt); }
+  opt_pass *clone () { return new pass_late_warn_uninitialized (m_ctxt); }
   virtual bool gate (function *) { return gate_warn_uninitialized (); }
   virtual unsigned int execute (function *);
 
@@ -2437,8 +2394,7 @@ pass_late_warn_uninitialized::execute (function *fun)
 	for (i = 0; i < n; ++i)
 	  {
 	    tree op = gimple_phi_arg_def (phi, i);
-	    if (TREE_CODE (op) == SSA_NAME
-		&& uninit_undefined_value_p (op))
+	    if (TREE_CODE (op) == SSA_NAME && uninit_undefined_value_p (op))
 	      {
 		worklist.safe_push (phi);
 		added_to_worklist.add (phi);
@@ -2475,12 +2431,11 @@ make_pass_late_warn_uninitialized (gcc::context *ctxt)
   return new pass_late_warn_uninitialized (ctxt);
 }
 
-
 static unsigned int
 execute_early_warn_uninitialized (void)
 {
   /* Currently, this pass runs always but
-     execute_late_warn_uninitialized only runs with optimization. With
+     execute_late_warn_uninitialized only runs with optimization.  With
      optimization we want to warn about possible uninitialized as late
      as possible, thus don't do it here.  However, without
      optimization we need to warn here about "may be uninitialized".  */
@@ -2488,14 +2443,13 @@ execute_early_warn_uninitialized (void)
 
   warn_uninitialized_vars (/*warn_possibly_uninitialized=*/!optimize);
 
-  /* Post-dominator information can not be reliably updated. Free it
+  /* Post-dominator information can not be reliably updated.  Free it
      after the use.  */
 
   free_dominance_info (CDI_POST_DOMINATORS);
   return 0;
 }
 
-
 namespace {
 
 const pass_data pass_data_early_warn_uninitialized =
@@ -2521,9 +2475,9 @@ public:
   /* opt_pass methods: */
   virtual bool gate (function *) { return gate_warn_uninitialized (); }
   virtual unsigned int execute (function *)
-    {
-      return execute_early_warn_uninitialized ();
-    }
+  {
+    return execute_early_warn_uninitialized ();
+  }
 
 }; // class pass_early_warn_uninitialized
 
-- 
2.6.3


^ permalink raw reply	[flat|nested] 42+ messages in thread

* Re: [PATCH] Fix memory leaks in tree-ssa-uninit.c
  2015-11-20 11:15                     ` Martin Liška
@ 2015-11-26 20:59                       ` Martin Liška
  2015-11-26 21:08                         ` Bernd Schmidt
  0 siblings, 1 reply; 42+ messages in thread
From: Martin Liška @ 2015-11-26 20:59 UTC (permalink / raw)
  To: gcc-patches; +Cc: Jeff Law

On 11/20/2015 12:15 PM, Martin Liška wrote:
> On 11/20/2015 03:14 AM, Bernd Schmidt wrote:
>> BTW, I'm with whoever said absolutely no way to the idea of making automatic changes like this as part of a commit hook.
>>
>> I think the whitespace change can go in if it hasn't already, but I think the other one still has enough problems that I'll say - leave it for the next stage 1.
>>
>>> @@ -178,8 +173,9 @@ warn_uninitialized_vars (bool warn_possibly_uninitialized)
>>>
>>>     FOR_EACH_BB_FN (bb, cfun)
>>>       {
>>> -      bool always_executed = dominated_by_p (CDI_POST_DOMINATORS,
>>> -                         single_succ (ENTRY_BLOCK_PTR_FOR_FN (cfun)), bb);
>>> +      bool always_executed
>>> +    = dominated_by_p (CDI_POST_DOMINATORS,
>>> +              single_succ (ENTRY_BLOCK_PTR_FOR_FN (cfun)), bb);
>>>         for (gsi = gsi_start_bb (bb); !gsi_end_p (gsi); gsi_next (&gsi))
>>>       {
>>
>> Better to pull the single_succ into its own variable perhaps?
>>
>>> @@ -1057,7 +1039,8 @@ prune_uninit_phi_opnds_in_unrealizable_paths (gphi *phi,
>>>            *visited_flag_phis = BITMAP_ALLOC (NULL);
>>>
>>>          if (bitmap_bit_p (*visited_flag_phis,
>>> -                SSA_NAME_VERSION (gimple_phi_result (flag_arg_def))))
>>> +                SSA_NAME_VERSION (
>>> +                  gimple_phi_result (flag_arg_def))))
>>>            return false;
>>>
>>>          bitmap_set_bit (*visited_flag_phis,
>>
>> Pull the gimple_phi_result into a separate variable, or just leave it unchanged for now, the modified version is too ugly to live.
>>
>>>          bitmap_clear_bit (*visited_flag_phis,
>>> -                SSA_NAME_VERSION (gimple_phi_result (flag_arg_def)));
>>> +                SSA_NAME_VERSION (
>>> +                  gimple_phi_result (flag_arg_def)));
>>>          continue;
>>>        }
>>
>> Here too.
>>
>>> -  all_pruned = prune_uninit_phi_opnds_in_unrealizable_paths (phi,
>>> -                                 uninit_opnds,
>>> -                                 as_a <gphi *> (flag_def),
>>> -                                 boundary_cst,
>>> -                                 cmp_code,
>>> -                                 visited_phis,
>>> -                                 &visited_flag_phis);
>>> +  all_pruned = prune_uninit_phi_opnds_in_unrealizable_paths
>>> +    (phi, uninit_opnds, as_a<gphi *> (flag_def), boundary_cst, cmp_code,
>>> +     visited_phis, &visited_flag_phis);
>>
>> I'd rather shorten the name of the function, even if it goes against the spirit of the novel writing month.
>>
>>> -      if (gphi *use_phi = dyn_cast <gphi *> (use_stmt))
>>> -    use_bb = gimple_phi_arg_edge (use_phi,
>>> -                      PHI_ARG_INDEX_FROM_USE (use_p))->src;
>>> +      if (gphi *use_phi = dyn_cast<gphi *> (use_stmt))
>>> +    use_bb
>>> +      = gimple_phi_arg_edge (use_phi, PHI_ARG_INDEX_FROM_USE (use_p))->src;
>>>          else
>>>        use_bb = gimple_bb (use_stmt);
>>
>> There are some changes of this nature and I'm not sure it's an improvement. Leave them out for now?
>>
>>> @@ -2345,8 +2309,8 @@ warn_uninitialized_phi (gphi *phi, vec<gphi *> *worklist,
>>>        }
>>>
>>>      /* Now check if we have any use of the value without proper guard.  */
>>> -  uninit_use_stmt = find_uninit_use (phi, uninit_opnds,
>>> -                     worklist, added_to_worklist);
>>> +  uninit_use_stmt
>>> +    = find_uninit_use (phi, uninit_opnds, worklist, added_to_worklist);
>>>
>>>      /* All uses are properly guarded.  */
>>>      if (!uninit_use_stmt)
>>
>> Here too.
>>
>>> @@ -2396,12 +2359,24 @@ public:
>>>      {}
>>>
>>>      /* opt_pass methods: */
>>> -  opt_pass * clone () { return new pass_late_warn_uninitialized (m_ctxt); }
>>> -  virtual bool gate (function *) { return gate_warn_uninitialized (); }
>>> +  opt_pass *clone ();
>>> +  virtual bool gate (function *);
>>
>> This may technically violate our coding standards, but it's consistent with a lot of similar cases. Since coding standards are about enforcing consistency, I'd drop this change.
>>
>>>    namespace {
>>>
>>>    const pass_data pass_data_early_warn_uninitialized =
>>>    {
>>> -  GIMPLE_PASS, /* type */
>>> +  GIMPLE_PASS,               /* type */
>>>      "*early_warn_uninitialized", /* name */
>>> -  OPTGROUP_NONE, /* optinfo_flags */
>>> -  TV_TREE_UNINIT, /* tv_id */
>>> -  PROP_ssa, /* properties_required */
>>> -  0, /* properties_provided */
>>> -  0, /* properties_destroyed */
>>> -  0, /* todo_flags_start */
>>> -  0, /* todo_flags_finish */
>>> +  OPTGROUP_NONE,           /* optinfo_flags */
>>> +  TV_TREE_UNINIT,           /* tv_id */
>>> +  PROP_ssa,               /* properties_required */
>>> +  0,                   /* properties_provided */
>>> +  0,                   /* properties_destroyed */
>>> +  0,                   /* todo_flags_start */
>>> +  0,                   /* todo_flags_finish */
>>>    };
>>
>> Likewise. Seems to be done practically nowhere.
>>
>>>    class pass_early_warn_uninitialized : public gimple_opt_pass
>>> @@ -2519,14 +2491,23 @@ public:
>>>      {}
>>>
>>>      /* opt_pass methods: */
>>> -  virtual bool gate (function *) { return gate_warn_uninitialized (); }
>>> -  virtual unsigned int execute (function *)
>>> -    {
>>> -      return execute_early_warn_uninitialized ();
>>> -    }
>>> +  virtual bool gate (function *);
>>> +  virtual unsigned int execute (function *);
>>
>> Likewise.
>>
>>
>> Bernd
>
> Hi.
>
> Enhanced patch should cover all notes pointed in the previous email.
>
> Martin
>

PING.

Is the patch still candidate to be merged in current stage3, or should I leave it to the next stage1?
What about the first patch or the patch, where I just applied replacement of whitespaces?

Thanks,
Martin

^ permalink raw reply	[flat|nested] 42+ messages in thread

* Re: [PATCH] Fix memory leaks in tree-ssa-uninit.c
  2015-11-26 20:59                       ` Martin Liška
@ 2015-11-26 21:08                         ` Bernd Schmidt
  2016-05-06 10:06                           ` [PATCH] Fix coding style " Martin Liška
  0 siblings, 1 reply; 42+ messages in thread
From: Bernd Schmidt @ 2015-11-26 21:08 UTC (permalink / raw)
  To: Martin Liška, gcc-patches; +Cc: Jeff Law

On 11/26/2015 09:53 PM, Martin Liška wrote:
> Is the patch still candidate to be merged in current stage3, or should I
> leave it to the next stage1?
> What about the first patch or the patch, where I just applied
> replacement of whitespaces?

As I said previously, the one to just replace whitespace is ok for now. 
Please ping the other one when stage1 opens (I expect it'll need changes 
by then).


Bernd

^ permalink raw reply	[flat|nested] 42+ messages in thread

* [PATCH] Fix coding style in tree-ssa-uninit.c
  2015-11-26 21:08                         ` Bernd Schmidt
@ 2016-05-06 10:06                           ` Martin Liška
  2016-05-06 10:51                             ` Richard Biener
  0 siblings, 1 reply; 42+ messages in thread
From: Martin Liška @ 2016-05-06 10:06 UTC (permalink / raw)
  To: Bernd Schmidt, gcc-patches; +Cc: Jeff Law

[-- Attachment #1: Type: text/plain, Size: 411 bytes --]

On 11/26/2015 10:04 PM, Bernd Schmidt wrote:
> As I said previously, the one to just replace whitespace is ok for now. Please ping the other one when stage1 opens (I expect it'll need changes by then).
> 
> 
> Bernd

Hello.

This part of the part remains to be installed from the previous stage3.
I've rebased the patch and rerun reg&bootstrap on x88_64-linux-gnu system.

Ready to be installed?
Thanks,
Martin

[-- Attachment #2: 0001-Manual-changes-to-GCC-coding-style-in-tree-ssa-unini.patch --]
[-- Type: text/x-patch, Size: 40449 bytes --]

From 8344ef65208e86493c0af82e41c031543717af45 Mon Sep 17 00:00:00 2001
From: marxin <mliska@suse.cz>
Date: Mon, 2 May 2016 14:49:14 +0200
Subject: [PATCH] Manual changes to GCC coding style in tree-ssa-uninit.c

gcc/ChangeLog:

2016-05-02  Martin Liska  <mliska@suse.cz>

	* tree-ssa-uninit.c: Apply manual changes
	to the GNU coding style.
	(prune_uninit_phi_opnds): Rename from
	prune_uninit_phi_opnds_in_unrealizable_paths.
---
 gcc/tree-ssa-uninit.c | 401 ++++++++++++++++++++++----------------------------
 1 file changed, 179 insertions(+), 222 deletions(-)

diff --git a/gcc/tree-ssa-uninit.c b/gcc/tree-ssa-uninit.c
index ea3ceb8..941d575 100644
--- a/gcc/tree-ssa-uninit.c
+++ b/gcc/tree-ssa-uninit.c
@@ -35,16 +35,15 @@ along with GCC; see the file COPYING3.  If not see
 #include "tree-cfg.h"
 
 /* This implements the pass that does predicate aware warning on uses of
-   possibly uninitialized variables. The pass first collects the set of
-   possibly uninitialized SSA names. For each such name, it walks through
-   all its immediate uses. For each immediate use, it rebuilds the condition
-   expression (the predicate) that guards the use. The predicate is then
+   possibly uninitialized variables.  The pass first collects the set of
+   possibly uninitialized SSA names.  For each such name, it walks through
+   all its immediate uses.  For each immediate use, it rebuilds the condition
+   expression (the predicate) that guards the use.  The predicate is then
    examined to see if the variable is always defined under that same condition.
    This is done either by pruning the unrealizable paths that lead to the
    default definitions or by checking if the predicate set that guards the
    defining paths is a superset of the use predicate.  */
 
-
 /* Pointer set of potentially undefined ssa names, i.e.,
    ssa names that are defined by phi with operands that
    are not defined or potentially undefined.  */
@@ -56,7 +55,7 @@ static hash_set<tree> *possibly_undefined_names = 0;
 #define MASK_EMPTY(mask) (mask == 0)
 
 /* Returns the first bit position (starting from LSB)
-   in mask that is non zero. Returns -1 if the mask is empty.  */
+   in mask that is non zero.  Returns -1 if the mask is empty.  */
 static int
 get_mask_first_set_bit (unsigned mask)
 {
@@ -80,13 +79,12 @@ has_undefined_value_p (tree t)
 	      && possibly_undefined_names->contains (t)));
 }
 
-
-
 /* Like has_undefined_value_p, but don't return true if TREE_NO_WARNING
    is set on SSA_NAME_VAR.  */
 
 static inline bool
-uninit_undefined_value_p (tree t) {
+uninit_undefined_value_p (tree t)
+{
   if (!has_undefined_value_p (t))
     return false;
   if (SSA_NAME_VAR (t) && TREE_NO_WARNING (SSA_NAME_VAR (t)))
@@ -112,7 +110,7 @@ uninit_undefined_value_p (tree t) {
 /* Emit a warning for EXPR based on variable VAR at the point in the
    program T, an SSA_NAME, is used being uninitialized.  The exact
    warning text is in MSGID and DATA is the gimple stmt with info about
-   the location in source code. When DATA is a GIMPLE_PHI, PHIARG_IDX
+   the location in source code.  When DATA is a GIMPLE_PHI, PHIARG_IDX
    gives which argument of the phi node to take the location from.  WC
    is the warning code.  */
 
@@ -149,8 +147,7 @@ warn_uninit (enum opt_code wc, tree t, tree expr, tree var,
   else
     location = DECL_SOURCE_LOCATION (var);
   location = linemap_resolve_location (line_table, location,
-				       LRK_SPELLING_LOCATION,
-				       NULL);
+				       LRK_SPELLING_LOCATION, NULL);
   cfun_loc = DECL_SOURCE_LOCATION (cfun->decl);
   xloc = expand_location (location);
   floc = expand_location (cfun_loc);
@@ -161,10 +158,8 @@ warn_uninit (enum opt_code wc, tree t, tree expr, tree var,
       if (location == DECL_SOURCE_LOCATION (var))
 	return;
       if (xloc.file != floc.file
-	  || linemap_location_before_p (line_table,
-					location, cfun_loc)
-	  || linemap_location_before_p (line_table,
-					cfun->function_end_locus,
+	  || linemap_location_before_p (line_table, location, cfun_loc)
+	  || linemap_location_before_p (line_table, cfun->function_end_locus,
 					location))
 	inform (DECL_SOURCE_LOCATION (var), "%qD was declared here", var);
     }
@@ -178,8 +173,8 @@ warn_uninitialized_vars (bool warn_possibly_uninitialized)
 
   FOR_EACH_BB_FN (bb, cfun)
     {
-      bool always_executed = dominated_by_p (CDI_POST_DOMINATORS,
-					     single_succ (ENTRY_BLOCK_PTR_FOR_FN (cfun)), bb);
+      basic_block succ = single_succ (ENTRY_BLOCK_PTR_FOR_FN (cfun));
+      bool always_executed = dominated_by_p (CDI_POST_DOMINATORS, succ, bb);
       for (gsi = gsi_start_bb (bb); !gsi_end_p (gsi); gsi_next (&gsi))
 	{
 	  gimple *stmt = gsi_stmt (gsi);
@@ -196,13 +191,13 @@ warn_uninitialized_vars (bool warn_possibly_uninitialized)
 	    {
 	      use = USE_FROM_PTR (use_p);
 	      if (always_executed)
-		warn_uninit (OPT_Wuninitialized, use,
-			     SSA_NAME_VAR (use), SSA_NAME_VAR (use),
-			     "%qD is used uninitialized in this function",
-			     stmt, UNKNOWN_LOCATION);
+		warn_uninit (OPT_Wuninitialized, use, SSA_NAME_VAR (use),
+			     SSA_NAME_VAR (use),
+			     "%qD is used uninitialized in this function", stmt,
+			     UNKNOWN_LOCATION);
 	      else if (warn_possibly_uninitialized)
-		warn_uninit (OPT_Wmaybe_uninitialized, use,
-			     SSA_NAME_VAR (use), SSA_NAME_VAR (use),
+		warn_uninit (OPT_Wmaybe_uninitialized, use, SSA_NAME_VAR (use),
+			     SSA_NAME_VAR (use),
 			     "%qD may be used uninitialized in this function",
 			     stmt, UNKNOWN_LOCATION);
 	    }
@@ -232,9 +227,8 @@ warn_uninitialized_vars (bool warn_possibly_uninitialized)
 		continue;
 
 	      if (always_executed)
-		warn_uninit (OPT_Wuninitialized, use,
-			     gimple_assign_rhs1 (stmt), base,
-			     "%qE is used uninitialized in this function",
+		warn_uninit (OPT_Wuninitialized, use, gimple_assign_rhs1 (stmt),
+			     base, "%qE is used uninitialized in this function",
 			     stmt, UNKNOWN_LOCATION);
 	      else if (warn_possibly_uninitialized)
 		warn_uninit (OPT_Wmaybe_uninitialized, use,
@@ -250,9 +244,9 @@ warn_uninitialized_vars (bool warn_possibly_uninitialized)
 
 /* Checks if the operand OPND of PHI is defined by
    another phi with one operand defined by this PHI,
-   but the rest operands are all defined. If yes,
+   but the rest operands are all defined.  If yes,
    returns true to skip this operand as being
-   redundant. Can be enhanced to be more general.  */
+   redundant.  Can be enhanced to be more general.  */
 
 static bool
 can_skip_redundant_opnd (tree opnd, gimple *phi)
@@ -318,37 +312,35 @@ compute_uninit_opnds_pos (gphi *phi)
 static inline basic_block
 find_pdom (basic_block block)
 {
-   if (block == EXIT_BLOCK_PTR_FOR_FN (cfun))
-     return EXIT_BLOCK_PTR_FOR_FN (cfun);
-   else
-     {
-       basic_block bb
-	   = get_immediate_dominator (CDI_POST_DOMINATORS, block);
-       if (! bb)
-	 return EXIT_BLOCK_PTR_FOR_FN (cfun);
-       return bb;
-     }
+  if (block == EXIT_BLOCK_PTR_FOR_FN (cfun))
+    return EXIT_BLOCK_PTR_FOR_FN (cfun);
+  else
+    {
+      basic_block bb = get_immediate_dominator (CDI_POST_DOMINATORS, block);
+      if (!bb)
+	return EXIT_BLOCK_PTR_FOR_FN (cfun);
+      return bb;
+    }
 }
 
-/* Find the immediate DOM of the specified
-   basic block BLOCK.  */
+/* Find the immediate DOM of the specified basic block BLOCK.  */
 
 static inline basic_block
 find_dom (basic_block block)
 {
-   if (block == ENTRY_BLOCK_PTR_FOR_FN (cfun))
-     return ENTRY_BLOCK_PTR_FOR_FN (cfun);
-   else
-     {
-       basic_block bb = get_immediate_dominator (CDI_DOMINATORS, block);
-       if (! bb)
-	 return ENTRY_BLOCK_PTR_FOR_FN (cfun);
-       return bb;
-     }
+  if (block == ENTRY_BLOCK_PTR_FOR_FN (cfun))
+    return ENTRY_BLOCK_PTR_FOR_FN (cfun);
+  else
+    {
+      basic_block bb = get_immediate_dominator (CDI_DOMINATORS, block);
+      if (!bb)
+	return ENTRY_BLOCK_PTR_FOR_FN (cfun);
+      return bb;
+    }
 }
 
 /* Returns true if BB1 is postdominating BB2 and BB1 is
-   not a loop exit bb. The loop exit bb check is simple and does
+   not a loop exit bb.  The loop exit bb check is simple and does
    not cover all cases.  */
 
 static bool
@@ -366,7 +358,7 @@ is_non_loop_exit_postdominating (basic_block bb1, basic_block bb2)
 /* Find the closest postdominator of a specified BB, which is control
    equivalent to BB.  */
 
-static inline  basic_block
+static inline basic_block
 find_control_equiv_block (basic_block bb)
 {
   basic_block pdom;
@@ -424,7 +416,7 @@ compute_control_dep_chain (basic_block bb, basic_block dep_bb,
   for (i = 0; i < cur_chain_len; i++)
     {
       edge e = (*cur_cd_chain)[i];
-      /* Cycle detected. */
+      /* Cycle detected.  */
       if (e->src == bb)
 	return false;
     }
@@ -454,8 +446,8 @@ compute_control_dep_chain (basic_block bb, basic_block dep_bb,
 	    }
 
 	  /* Now check if DEP_BB is indirectly control dependent on BB.  */
-	  if (compute_control_dep_chain (cd_bb, dep_bb, cd_chains,
-					 num_chains, cur_cd_chain, num_calls))
+	  if (compute_control_dep_chain (cd_bb, dep_bb, cd_chains, num_chains,
+					 cur_cd_chain, num_calls))
 	    {
 	      found_cd_chain = true;
 	      break;
@@ -463,8 +455,8 @@ compute_control_dep_chain (basic_block bb, basic_block dep_bb,
 
 	  cd_bb = find_pdom (cd_bb);
 	  post_dom_check++;
-	  if (cd_bb == EXIT_BLOCK_PTR_FOR_FN (cfun) || post_dom_check >
-	      MAX_POSTDOM_CHECK)
+	  if (cd_bb == EXIT_BLOCK_PTR_FOR_FN (cfun)
+	      || post_dom_check > MAX_POSTDOM_CHECK)
 	    break;
 	}
       cur_cd_chain->pop ();
@@ -475,7 +467,7 @@ compute_control_dep_chain (basic_block bb, basic_block dep_bb,
   return found_cd_chain;
 }
 
-/* The type to represent a simple predicate  */
+/* The type to represent a simple predicate.  */
 
 struct pred_info
 {
@@ -496,13 +488,13 @@ typedef vec<pred_info, va_heap, vl_ptr> pred_chain;
 typedef vec<pred_chain, va_heap, vl_ptr> pred_chain_union;
 
 /* Converts the chains of control dependence edges into a set of
-   predicates. A control dependence chain is represented by a vector
-   edges. DEP_CHAINS points to an array of dependence chains.
-   NUM_CHAINS is the size of the chain array. One edge in a dependence
+   predicates.  A control dependence chain is represented by a vector
+   edges.  DEP_CHAINS points to an array of dependence chains.
+   NUM_CHAINS is the size of the chain array.  One edge in a dependence
    chain is mapped to predicate expression represented by pred_info
-   type. One dependence chain is converted to a composite predicate that
+   type.  One dependence chain is converted to a composite predicate that
    is the result of AND operation of pred_info mapped to each edge.
-   A composite predicate is presented by a vector of pred_info. On
+   A composite predicate is presented by a vector of pred_info.  On
    return, *PREDS points to the resulting array of composite predicates.
    *NUM_PREDS is the number of composite predictes.  */
 
@@ -543,13 +535,9 @@ convert_control_dep_chain_into_preds (vec<edge> *dep_chains,
 	      break;
 	    }
 	  cond_stmt = gsi_stmt (gsi);
-	  if (is_gimple_call (cond_stmt)
-	      && EDGE_COUNT (e->src->succs) >= 2)
-	    {
-	      /* Ignore EH edge. Can add assertion
-		 on the other edge's flag.  */
-	      continue;
-	    }
+	  if (is_gimple_call (cond_stmt) && EDGE_COUNT (e->src->succs) >= 2)
+	    /* Ignore EH edge.  Can add assertion on the other edge's flag.  */
+	    continue;
 	  /* Skip if there is essentially one succesor.  */
 	  if (EDGE_COUNT (e->src->succs) == 2)
 	    {
@@ -577,7 +565,7 @@ convert_control_dep_chain_into_preds (vec<edge> *dep_chains,
 	      t_chain.safe_push (one_pred);
 	      has_valid_pred = true;
 	    }
-	  else if (gswitch *gs = dyn_cast <gswitch *> (cond_stmt))
+	  else if (gswitch *gs = dyn_cast<gswitch *> (cond_stmt))
 	    {
 	      /* Avoid quadratic behavior.  */
 	      if (gimple_switch_num_labels (gs) > MAX_SWITCH_CASES)
@@ -607,8 +595,8 @@ convert_control_dep_chain_into_preds (vec<edge> *dep_chains,
 		 fail.  */
 	      if (!l
 		  || !CASE_LOW (l)
-		  || (CASE_HIGH (l) && !operand_equal_p (CASE_LOW (l),
-							 CASE_HIGH (l), 0)))
+		  || (CASE_HIGH (l)
+		      && !operand_equal_p (CASE_LOW (l), CASE_HIGH (l), 0)))
 		{
 		  has_valid_pred = false;
 		  break;
@@ -635,7 +623,7 @@ convert_control_dep_chain_into_preds (vec<edge> *dep_chains,
   return has_valid_pred;
 }
 
-/* Computes all control dependence chains for USE_BB. The control
+/* Computes all control dependence chains for USE_BB.  The control
    dependence chains are then converted to an array of composite
    predicates pointed to by PREDS.  PHI_BB is the basic block of
    the phi whose result is used in USE_BB.  */
@@ -676,8 +664,8 @@ find_predicates (pred_chain_union *preds,
 
 /* Computes the set of incoming edges of PHI that have non empty
    definitions of a phi chain.  The collection will be done
-   recursively on operands that are defined by phis. CD_ROOT
-   is the control dependence root. *EDGES holds the result, and
+   recursively on operands that are defined by phis.  CD_ROOT
+   is the control dependence root.  *EDGES holds the result, and
    VISITED_PHIS is a pointer set for detecting cycles.  */
 
 static void
@@ -702,7 +690,7 @@ collect_phi_def_edges (gphi *phi, basic_block cd_root,
 	{
 	  if (dump_file && (dump_flags & TDF_DETAILS))
 	    {
-	      fprintf (dump_file, "\n[CHECK] Found def edge %d in ", (int)i);
+	      fprintf (dump_file, "\n[CHECK] Found def edge %d in ", (int) i);
 	      print_gimple_stmt (dump_file, phi, 0, 0);
 	    }
 	  edges->safe_push (opnd_edge);
@@ -712,15 +700,15 @@ collect_phi_def_edges (gphi *phi, basic_block cd_root,
 	  gimple *def = SSA_NAME_DEF_STMT (opnd);
 
 	  if (gimple_code (def) == GIMPLE_PHI
-	      && dominated_by_p (CDI_DOMINATORS,
-				 gimple_bb (def), cd_root))
-	    collect_phi_def_edges (as_a <gphi *> (def), cd_root, edges,
+	      && dominated_by_p (CDI_DOMINATORS, gimple_bb (def), cd_root))
+	    collect_phi_def_edges (as_a<gphi *> (def), cd_root, edges,
 				   visited_phis);
 	  else if (!uninit_undefined_value_p (opnd))
 	    {
 	      if (dump_file && (dump_flags & TDF_DETAILS))
 		{
-		  fprintf (dump_file, "\n[CHECK] Found def edge %d in ", (int)i);
+		  fprintf (dump_file, "\n[CHECK] Found def edge %d in ",
+			   (int) i);
 		  print_gimple_stmt (dump_file, phi, 0, 0);
 		}
 	      edges->safe_push (opnd_edge);
@@ -745,7 +733,7 @@ find_def_preds (pred_chain_union *preds, gphi *phi)
 
   phi_bb = gimple_bb (phi);
   /* First find the closest dominating bb to be
-     the control dependence root  */
+     the control dependence root.  */
   cd_root = find_dom (phi_bb);
   if (!cd_root)
     return false;
@@ -789,8 +777,7 @@ find_def_preds (pred_chain_union *preds, gphi *phi)
 /* Dumps the predicates (PREDS) for USESTMT.  */
 
 static void
-dump_predicates (gimple *usestmt, pred_chain_union preds,
-		 const char* msg)
+dump_predicates (gimple *usestmt, pred_chain_union preds, const char *msg)
 {
   size_t i, j;
   pred_chain one_pred_chain = vNULL;
@@ -839,13 +826,11 @@ destroy_predicate_vecs (pred_chain_union *preds)
   preds->release ();
 }
 
-
 /* Computes the 'normalized' conditional code with operand
    swapping and condition inversion.  */
 
 static enum tree_code
-get_cmp_code (enum tree_code orig_cmp_code,
-	      bool swap_cond, bool invert)
+get_cmp_code (enum tree_code orig_cmp_code, bool swap_cond, bool invert)
 {
   enum tree_code tc = orig_cmp_code;
 
@@ -880,14 +865,12 @@ is_value_included_in (tree val, tree boundary, enum tree_code cmpc)
   bool result;
 
   /* Only handle integer constant here.  */
-  if (TREE_CODE (val) != INTEGER_CST
-      || TREE_CODE (boundary) != INTEGER_CST)
+  if (TREE_CODE (val) != INTEGER_CST || TREE_CODE (boundary) != INTEGER_CST)
     return true;
 
   is_unsigned = TYPE_UNSIGNED (TREE_TYPE (val));
 
-  if (cmpc == GE_EXPR || cmpc == GT_EXPR
-      || cmpc == NE_EXPR)
+  if (cmpc == GE_EXPR || cmpc == GT_EXPR || cmpc == NE_EXPR)
     {
       cmpc = invert_tree_comparison (cmpc, false);
       inverted = true;
@@ -949,7 +932,7 @@ find_matching_predicate_in_rest_chains (pred_info pred,
 	{
 	  pred_info pred2 = one_chain[j];
 	  /* Can relax the condition comparison to not
-	     use address comparison. However, the most common
+	     use address comparison.  However, the most common
 	     case is that multiple control dependent paths share
 	     a common path prefix, so address comparison should
 	     be ok.  */
@@ -969,16 +952,15 @@ find_matching_predicate_in_rest_chains (pred_info pred,
 }
 
 /* Forward declaration.  */
-static bool
-is_use_properly_guarded (gimple *use_stmt,
-			 basic_block use_bb,
-			 gphi *phi,
-			 unsigned uninit_opnds,
-			 pred_chain_union *def_preds,
-			 hash_set<gphi *> *visited_phis);
-
-/* Returns true if all uninitialized opnds are pruned. Returns false
-   otherwise. PHI is the phi node with uninitialized operands,
+static bool is_use_properly_guarded (gimple *use_stmt,
+				     basic_block use_bb,
+				     gphi *phi,
+				     unsigned uninit_opnds,
+				     pred_chain_union *def_preds,
+				     hash_set<gphi *> *visited_phis);
+
+/* Returns true if all uninitialized opnds are pruned.  Returns false
+   otherwise.  PHI is the phi node with uninitialized operands,
    UNINIT_OPNDS is the bitmap of the uninitialize operand positions,
    FLAG_DEF is the statement defining the flag guarding the use of the
    PHI output, BOUNDARY_CST is the const value used in the predicate
@@ -990,7 +972,7 @@ is_use_properly_guarded (gimple *use_stmt,
    Example scenario:
 
    BB1:
-   flag_1 = phi <0, 1>		  // (1)
+   flag_1 = phi <0, 1>			// (1)
    var_1  = phi <undef, some_val>
 
 
@@ -1001,24 +983,20 @@ is_use_properly_guarded (gimple *use_stmt,
       goto BB3;
 
    BB3:
-   use of var_2			 // (3)
+   use of var_2				// (3)
 
    Because some flag arg in (1) is not constant, if we do not look into the
    flag phis recursively, it is conservatively treated as unknown and var_1
-   is thought to be flowed into use at (3). Since var_1 is potentially uninitialized
-   a false warning will be emitted. Checking recursively into (1), the compiler can
-   find out that only some_val (which is defined) can flow into (3) which is OK.
-
-*/
+   is thought to be flowed into use at (3).  Since var_1 is potentially
+   uninitialized a false warning will be emitted.
+   Checking recursively into (1), the compiler can find out that only some_val
+   (which is defined) can flow into (3) which is OK.  */
 
 static bool
-prune_uninit_phi_opnds_in_unrealizable_paths (gphi *phi,
-					      unsigned uninit_opnds,
-					      gphi *flag_def,
-					      tree boundary_cst,
-					      enum tree_code cmp_code,
-					      hash_set<gphi *> *visited_phis,
-					      bitmap *visited_flag_phis)
+prune_uninit_phi_opnds (gphi *phi, unsigned uninit_opnds, gphi *flag_def,
+			tree boundary_cst, enum tree_code cmp_code,
+			hash_set<gphi *> *visited_phis,
+			bitmap *visited_flag_phis)
 {
   unsigned i;
 
@@ -1038,7 +1016,7 @@ prune_uninit_phi_opnds_in_unrealizable_paths (gphi *phi,
 
 	  if (TREE_CODE (flag_arg) != SSA_NAME)
 	    return false;
-	  flag_arg_def = dyn_cast <gphi *> (SSA_NAME_DEF_STMT (flag_arg));
+	  flag_arg_def = dyn_cast<gphi *> (SSA_NAME_DEF_STMT (flag_arg));
 	  if (!flag_arg_def)
 	    return false;
 
@@ -1046,7 +1024,7 @@ prune_uninit_phi_opnds_in_unrealizable_paths (gphi *phi,
 	  if (TREE_CODE (phi_arg) != SSA_NAME)
 	    return false;
 
-	  phi_arg_def = dyn_cast <gphi *> (SSA_NAME_DEF_STMT (phi_arg));
+	  phi_arg_def = dyn_cast<gphi *> (SSA_NAME_DEF_STMT (phi_arg));
 	  if (!phi_arg_def)
 	    return false;
 
@@ -1056,8 +1034,8 @@ prune_uninit_phi_opnds_in_unrealizable_paths (gphi *phi,
 	  if (!*visited_flag_phis)
 	    *visited_flag_phis = BITMAP_ALLOC (NULL);
 
-	  if (bitmap_bit_p (*visited_flag_phis,
-			    SSA_NAME_VERSION (gimple_phi_result (flag_arg_def))))
+	  tree phi_result = gimple_phi_result (flag_arg_def);
+	  if (bitmap_bit_p (*visited_flag_phis, SSA_NAME_VERSION (phi_result)))
 	    return false;
 
 	  bitmap_set_bit (*visited_flag_phis,
@@ -1065,13 +1043,13 @@ prune_uninit_phi_opnds_in_unrealizable_paths (gphi *phi,
 
 	  /* Now recursively prune the uninitialized phi args.  */
 	  uninit_opnds_arg_phi = compute_uninit_opnds_pos (phi_arg_def);
-	  if (!prune_uninit_phi_opnds_in_unrealizable_paths
-		 (phi_arg_def, uninit_opnds_arg_phi, flag_arg_def,
-		  boundary_cst, cmp_code, visited_phis, visited_flag_phis))
+	  if (!prune_uninit_phi_opnds
+	      (phi_arg_def, uninit_opnds_arg_phi, flag_arg_def, boundary_cst,
+	       cmp_code, visited_phis, visited_flag_phis))
 	    return false;
 
-	  bitmap_clear_bit (*visited_flag_phis,
-			    SSA_NAME_VERSION (gimple_phi_result (flag_arg_def)));
+	  phi_result = gimple_phi_result (flag_arg_def);
+	  bitmap_clear_bit (*visited_flag_phis, SSA_NAME_VERSION (phi_result));
 	  continue;
 	}
 
@@ -1082,7 +1060,7 @@ prune_uninit_phi_opnds_in_unrealizable_paths (gphi *phi,
 	  gimple *opnd_def;
 
 	  /* Now that we know that this undefined edge is not
-	     pruned. If the operand is defined by another phi,
+	     pruned.  If the operand is defined by another phi,
 	     we can further prune the incoming edges of that
 	     phi by checking the predicates of this operands.  */
 
@@ -1091,8 +1069,7 @@ prune_uninit_phi_opnds_in_unrealizable_paths (gphi *phi,
 	  if (gphi *opnd_def_phi = dyn_cast <gphi *> (opnd_def))
 	    {
 	      edge opnd_edge;
-	      unsigned uninit_opnds2
-		  = compute_uninit_opnds_pos (opnd_def_phi);
+	      unsigned uninit_opnds2 = compute_uninit_opnds_pos (opnd_def_phi);
 	      if (!MASK_EMPTY (uninit_opnds2))
 		{
 		  pred_chain_union def_preds = vNULL;
@@ -1143,11 +1120,11 @@ prune_uninit_phi_opnds_in_unrealizable_paths (gphi *phi,
 	     return true;
 	 }
 
-	 void foo(..)
+	 void foo (..)
 	 {
 	     int x;
 
-	     if (!init_func(&x))
+	     if (!init_func (&x))
 		return;
 
 	     .. some_code ...
@@ -1179,7 +1156,7 @@ prune_uninit_phi_opnds_in_unrealizable_paths (gphi *phi,
 	<==> false
 
      This implementation provides framework that can handle
-     scenarios. (Note that many simple cases are handled properly
+     scenarios.  (Note that many simple cases are handled properly
      without the predicate analysis -- this is due to jump threading
      transformation which eliminates the merge point thus makes
      path sensitive analysis unnecessary.)
@@ -1187,10 +1164,9 @@ prune_uninit_phi_opnds_in_unrealizable_paths (gphi *phi,
      NUM_PREDS is the number is the number predicate chains, PREDS is
      the array of chains, PHI is the phi node whose incoming (undefined)
      paths need to be pruned, and UNINIT_OPNDS is the bitmap holding
-     uninit operand positions. VISITED_PHIS is the pointer set of phi
+     uninit operand positions.  VISITED_PHIS is the pointer set of phi
      stmts being checked.  */
 
-
 static bool
 use_pred_not_overlap_with_undef_path_pred (pred_chain_union preds,
 					   gphi *phi, unsigned uninit_opnds,
@@ -1198,7 +1174,7 @@ use_pred_not_overlap_with_undef_path_pred (pred_chain_union preds,
 {
   unsigned int i, n;
   gimple *flag_def = 0;
-  tree  boundary_cst = 0;
+  tree boundary_cst = 0;
   enum tree_code cmp_code;
   bool swap_cond = false;
   bool invert = false;
@@ -1265,13 +1241,9 @@ use_pred_not_overlap_with_undef_path_pred (pred_chain_union preds,
   if (cmp_code == ERROR_MARK)
     return false;
 
-  all_pruned = prune_uninit_phi_opnds_in_unrealizable_paths (phi,
-							     uninit_opnds,
-							     as_a <gphi *> (flag_def),
-							     boundary_cst,
-							     cmp_code,
-							     visited_phis,
-							     &visited_flag_phis);
+  all_pruned = prune_uninit_phi_opnds
+    (phi, uninit_opnds, as_a<gphi *> (flag_def), boundary_cst, cmp_code,
+     visited_phis, &visited_flag_phis);
 
   if (visited_flag_phis)
     BITMAP_FREE (visited_flag_phis);
@@ -1280,7 +1252,7 @@ use_pred_not_overlap_with_undef_path_pred (pred_chain_union preds,
 }
 
 /* The helper function returns true if two predicates X1 and X2
-   are equivalent. It assumes the expressions have already
+   are equivalent.  It assumes the expressions have already
    properly re-associated.  */
 
 static inline bool
@@ -1307,8 +1279,8 @@ static inline bool
 is_neq_relop_p (pred_info pred)
 {
 
-  return (pred.cond_code == NE_EXPR && !pred.invert)
-	  || (pred.cond_code == EQ_EXPR && pred.invert);
+  return ((pred.cond_code == NE_EXPR && !pred.invert)
+	  || (pred.cond_code == EQ_EXPR && pred.invert));
 }
 
 /* Returns true if pred is of the form X != 0.  */
@@ -1335,7 +1307,7 @@ pred_expr_equal_p (pred_info x1, tree x2)
 }
 
 /* Returns true of the domain of single predicate expression
-   EXPR1 is a subset of that of EXPR2. Returns false if it
+   EXPR1 is a subset of that of EXPR2.  Returns false if it
    can not be proved.  */
 
 static bool
@@ -1360,8 +1332,7 @@ is_pred_expr_subset_of (pred_info expr1, pred_info expr2)
   if (expr2.invert)
     code2 = invert_tree_comparison (code2, false);
 
-  if ((code1 == EQ_EXPR || code1 == BIT_AND_EXPR)
-      && code2 == BIT_AND_EXPR)
+  if ((code1 == EQ_EXPR || code1 == BIT_AND_EXPR) && code2 == BIT_AND_EXPR)
     return wi::eq_p (expr1.pred_rhs,
 		     wi::bit_and (expr1.pred_rhs, expr2.pred_rhs));
 
@@ -1375,11 +1346,10 @@ is_pred_expr_subset_of (pred_info expr1, pred_info expr2)
 }
 
 /* Returns true if the domain of PRED1 is a subset
-   of that of PRED2. Returns false if it can not be proved so.  */
+   of that of PRED2.  Returns false if it can not be proved so.  */
 
 static bool
-is_pred_chain_subset_of (pred_chain pred1,
-			 pred_chain pred2)
+is_pred_chain_subset_of (pred_chain pred1, pred_chain pred2)
 {
   size_t np1, np2, i1, i2;
 
@@ -1407,7 +1377,7 @@ is_pred_chain_subset_of (pred_chain pred1,
 
 /* Returns true if the domain defined by
    one pred chain ONE_PRED is a subset of the domain
-   of *PREDS. It returns false if ONE_PRED's domain is
+   of *PREDS.  It returns false if ONE_PRED's domain is
    not a subset of any of the sub-domains of PREDS
    (corresponding to each individual chains in it), even
    though it may be still be a subset of whole domain
@@ -1431,15 +1401,15 @@ is_included_in (pred_chain one_pred, pred_chain_union preds)
 
 /* Compares two predicate sets PREDS1 and PREDS2 and returns
    true if the domain defined by PREDS1 is a superset
-   of PREDS2's domain. N1 and N2 are array sizes of PREDS1 and
-   PREDS2 respectively. The implementation chooses not to build
+   of PREDS2's domain.  N1 and N2 are array sizes of PREDS1 and
+   PREDS2 respectively.  The implementation chooses not to build
    generic trees (and relying on the folding capability of the
    compiler), but instead performs brute force comparison of
    individual predicate chains (won't be a compile time problem
-   as the chains are pretty short). When the function returns
+   as the chains are pretty short).  When the function returns
    false, it does not necessarily mean *PREDS1 is not a superset
    of *PREDS2, but mean it may not be so since the analysis can
-   not prove it. In such cases, false warnings may still be
+   not prove it.  In such cases, false warnings may still be
    emitted.  */
 
 static bool
@@ -1536,19 +1506,19 @@ simplify_pred (pred_chain *one_chain)
 
 	      if (pred_expr_equal_p (*b_pred, gimple_assign_rhs1 (def_stmt))
 		  || pred_expr_equal_p (*b_pred, gimple_assign_rhs2 (def_stmt)))
-		 {
-		   /* Mark a_pred for removal.  */
-		   a_pred->pred_lhs = NULL;
-		   a_pred->pred_rhs = NULL;
-		   simplified = true;
-		   break;
-		 }
+		{
+		  /* Mark a_pred for removal.  */
+		  a_pred->pred_lhs = NULL;
+		  a_pred->pred_rhs = NULL;
+		  simplified = true;
+		  break;
+		}
 	    }
 	}
     }
 
   if (!simplified)
-     return;
+    return;
 
   for (i = 0; i < n; i++)
     {
@@ -1558,8 +1528,8 @@ simplify_pred (pred_chain *one_chain)
       s_chain.safe_push (*a_pred);
     }
 
-   one_chain->release ();
-   *one_chain = s_chain;
+  one_chain->release ();
+  *one_chain = s_chain;
 }
 
 /* The helper function implements the rule 2 for the
@@ -1746,8 +1716,7 @@ simplify_preds_4 (pred_chain_union *preds)
 
 	  x2 = (*b_chain)[0];
 	  y2 = (*b_chain)[1];
-	  if (!is_neq_zero_form_p (x2)
-	      || !is_neq_zero_form_p (y2))
+	  if (!is_neq_zero_form_p (x2) || !is_neq_zero_form_p (y2))
 	    continue;
 
 	  if ((pred_expr_equal_p (x2, gimple_assign_rhs1 (def_stmt))
@@ -1780,7 +1749,6 @@ simplify_preds_4 (pred_chain_union *preds)
   return simplified;
 }
 
-
 /* This function simplifies predicates in PREDS.  */
 
 static void
@@ -1815,14 +1783,14 @@ simplify_preds (pred_chain_union *preds, gimple *use_or_def, bool is_use)
 
       if (simplify_preds_4 (preds))
 	changed = true;
-
-    } while (changed);
+    }
+  while (changed);
 
   return;
 }
 
 /* This is a helper function which attempts to normalize predicate chains
-  by following UD chains. It basically builds up a big tree of either IOR
+  by following UD chains.  It basically builds up a big tree of either IOR
   operations or AND operations, and convert the IOR tree into a
   pred_chain_union or BIT_AND tree into a pred_chain.
   Example:
@@ -1895,7 +1863,7 @@ get_pred_info_from_cmp (gimple *cmp_assign)
 }
 
 /* Returns true if the PHI is a degenerated phi with
-   all args with the same value (relop). In that case, *PRED
+   all args with the same value (relop).  In that case, *PRED
    will be updated to that value.  */
 
 static bool
@@ -1915,8 +1883,7 @@ is_degenerated_phi (gimple *phi, pred_info *pred_p)
   def0 = SSA_NAME_DEF_STMT (op0);
   if (gimple_code (def0) != GIMPLE_ASSIGN)
     return false;
-  if (TREE_CODE_CLASS (gimple_assign_rhs_code (def0))
-      != tcc_comparison)
+  if (TREE_CODE_CLASS (gimple_assign_rhs_code (def0)) != tcc_comparison)
     return false;
   pred0 = get_pred_info_from_cmp (def0);
 
@@ -1932,8 +1899,7 @@ is_degenerated_phi (gimple *phi, pred_info *pred_p)
       def = SSA_NAME_DEF_STMT (op);
       if (gimple_code (def) != GIMPLE_ASSIGN)
 	return false;
-      if (TREE_CODE_CLASS (gimple_assign_rhs_code (def))
-	  != tcc_comparison)
+      if (TREE_CODE_CLASS (gimple_assign_rhs_code (def)) != tcc_comparison)
 	return false;
       pred = get_pred_info_from_cmp (def);
       if (!pred_equal_p (pred, pred0))
@@ -1971,13 +1937,12 @@ normalize_one_pred_1 (pred_chain_union *norm_preds,
   if (gimple_code (def_stmt) == GIMPLE_PHI
       && is_degenerated_phi (def_stmt, &pred))
     work_list->safe_push (pred);
-  else if (gimple_code (def_stmt) == GIMPLE_PHI
-	   && and_or_code == BIT_IOR_EXPR)
+  else if (gimple_code (def_stmt) == GIMPLE_PHI && and_or_code == BIT_IOR_EXPR)
     {
       int i, n;
       n = gimple_phi_num_args (def_stmt);
 
-      /* If we see non zero constant, we should punt. The predicate
+      /* If we see non zero constant, we should punt.  The predicate
        * should be one guarding the phi edge.  */
       for (i = 0; i < n; ++i)
 	{
@@ -2048,8 +2013,7 @@ normalize_one_pred_1 (pred_chain_union *norm_preds,
 /* Normalize PRED and store the normalized predicates into NORM_PREDS.  */
 
 static void
-normalize_one_pred (pred_chain_union *norm_preds,
-		    pred_info pred)
+normalize_one_pred (pred_chain_union *norm_preds, pred_info pred)
 {
   vec<pred_info, va_heap, vl_ptr> work_list = vNULL;
   enum tree_code and_or_code = ERROR_MARK;
@@ -2064,17 +2028,15 @@ normalize_one_pred (pred_chain_union *norm_preds,
   gimple *def_stmt = SSA_NAME_DEF_STMT (pred.pred_lhs);
   if (gimple_code (def_stmt) == GIMPLE_ASSIGN)
     and_or_code = gimple_assign_rhs_code (def_stmt);
-  if (and_or_code != BIT_IOR_EXPR
-      && and_or_code != BIT_AND_EXPR)
+  if (and_or_code != BIT_IOR_EXPR && and_or_code != BIT_AND_EXPR)
     {
-      if (TREE_CODE_CLASS (and_or_code)
-	  == tcc_comparison)
+      if (TREE_CODE_CLASS (and_or_code) == tcc_comparison)
 	{
 	  pred_info n_pred = get_pred_info_from_cmp (def_stmt);
 	  push_pred (norm_preds, n_pred);
 	}
-       else
-	  push_pred (norm_preds, pred);
+      else
+	push_pred (norm_preds, pred);
       return;
     }
 
@@ -2084,8 +2046,8 @@ normalize_one_pred (pred_chain_union *norm_preds,
   while (!work_list.is_empty ())
     {
       pred_info a_pred = work_list.pop ();
-      normalize_one_pred_1 (norm_preds, &norm_chain, a_pred,
-			    and_or_code, &work_list, &mark_set);
+      normalize_one_pred_1 (norm_preds, &norm_chain, a_pred, and_or_code,
+			    &work_list, &mark_set);
     }
   if (and_or_code == BIT_AND_EXPR)
     norm_preds->safe_push (norm_chain);
@@ -2094,8 +2056,7 @@ normalize_one_pred (pred_chain_union *norm_preds,
 }
 
 static void
-normalize_one_pred_chain (pred_chain_union *norm_preds,
-			  pred_chain one_chain)
+normalize_one_pred_chain (pred_chain_union *norm_preds, pred_chain one_chain)
 {
   vec<pred_info, va_heap, vl_ptr> work_list = vNULL;
   hash_set<tree> mark_set;
@@ -2111,8 +2072,8 @@ normalize_one_pred_chain (pred_chain_union *norm_preds,
   while (!work_list.is_empty ())
     {
       pred_info a_pred = work_list.pop ();
-      normalize_one_pred_1 (0, &norm_chain, a_pred,
-			    BIT_AND_EXPR, &work_list, &mark_set);
+      normalize_one_pred_1 (0, &norm_chain, a_pred, BIT_AND_EXPR, &work_list,
+			    &mark_set);
     }
 
   norm_preds->safe_push (norm_chain);
@@ -2148,26 +2109,26 @@ normalize_preds (pred_chain_union preds, gimple *use_or_def, bool is_use)
   if (dump_file)
     {
       fprintf (dump_file, "[AFTER NORMALIZATION -- ");
-      dump_predicates (use_or_def, norm_preds, is_use ? "[USE]:\n" : "[DEF]:\n");
+      dump_predicates (use_or_def, norm_preds,
+		       is_use ? "[USE]:\n" : "[DEF]:\n");
     }
 
   destroy_predicate_vecs (&preds);
   return norm_preds;
 }
 
-
 /* Computes the predicates that guard the use and checks
    if the incoming paths that have empty (or possibly
-   empty) definition can be pruned/filtered. The function returns
+   empty) definition can be pruned/filtered.  The function returns
    true if it can be determined that the use of PHI's def in
    USE_STMT is guarded with a predicate set not overlapping with
    predicate sets of all runtime paths that do not have a definition.
 
-   Returns false if it is not or it can not be determined. USE_BB is
+   Returns false if it is not or it can not be determined.  USE_BB is
    the bb of the use (for phi operand use, the bb is not the bb of
    the phi stmt, but the src bb of the operand edge).
 
-   UNINIT_OPNDS is a bit vector. If an operand of PHI is uninitialized, the
+   UNINIT_OPNDS is a bit vector.  If an operand of PHI is uninitialized, the
    corresponding bit in the vector is 1.  VISITED_PHIS is a pointer
    set of phis being visited.
 
@@ -2206,7 +2167,7 @@ is_use_properly_guarded (gimple *use_stmt,
       return false;
     }
 
-  /* Try to prune the dead incoming phi edges. */
+  /* Try to prune the dead incoming phi edges.  */
   is_properly_guarded
     = use_pred_not_overlap_with_undef_path_pred (preds, phi, uninit_opnds,
 						 visited_phis);
@@ -2242,11 +2203,11 @@ is_use_properly_guarded (gimple *use_stmt,
 
 /* Searches through all uses of a potentially
    uninitialized variable defined by PHI and returns a use
-   statement if the use is not properly guarded. It returns
-   NULL if all uses are guarded. UNINIT_OPNDS is a bitvector
-   holding the position(s) of uninit PHI operands. WORKLIST
+   statement if the use is not properly guarded.  It returns
+   NULL if all uses are guarded.  UNINIT_OPNDS is a bitvector
+   holding the position(s) of uninit PHI operands.  WORKLIST
    is the vector of candidate phis that may be updated by this
-   function. ADDED_TO_WORKLIST is the pointer set tracking
+   function.  ADDED_TO_WORKLIST is the pointer set tracking
    if the new phi is already in the worklist.  */
 
 static gimple *
@@ -2271,7 +2232,7 @@ find_uninit_use (gphi *phi, unsigned uninit_opnds,
       if (is_gimple_debug (use_stmt))
 	continue;
 
-      if (gphi *use_phi = dyn_cast <gphi *> (use_stmt))
+      if (gphi *use_phi = dyn_cast<gphi *> (use_stmt))
 	use_bb = gimple_phi_arg_edge (use_phi,
 				      PHI_ARG_INDEX_FROM_USE (use_p))->src;
       else
@@ -2296,7 +2257,7 @@ find_uninit_use (gphi *phi, unsigned uninit_opnds,
 
       /* Found a phi use that is not guarded,
 	 add the phi to the worklist.  */
-      if (!added_to_worklist->add (as_a <gphi *> (use_stmt)))
+      if (!added_to_worklist->add (as_a<gphi *> (use_stmt)))
 	{
 	  if (dump_file && (dump_flags & TDF_DETAILS))
 	    {
@@ -2304,7 +2265,7 @@ find_uninit_use (gphi *phi, unsigned uninit_opnds,
 	      print_gimple_stmt (dump_file, use_stmt, 0, 0);
 	    }
 
-	  worklist->safe_push (as_a <gphi *> (use_stmt));
+	  worklist->safe_push (as_a<gphi *> (use_stmt));
 	  possibly_undefined_names->add (phi_result);
 	}
     }
@@ -2315,10 +2276,10 @@ find_uninit_use (gphi *phi, unsigned uninit_opnds,
 
 /* Look for inputs to PHI that are SSA_NAMEs that have empty definitions
    and gives warning if there exists a runtime path from the entry to a
-   use of the PHI def that does not contain a definition. In other words,
-   the warning is on the real use. The more dead paths that can be pruned
-   by the compiler, the fewer false positives the warning is. WORKLIST
-   is a vector of candidate phis to be examined. ADDED_TO_WORKLIST is
+   use of the PHI def that does not contain a definition.  In other words,
+   the warning is on the real use.  The more dead paths that can be pruned
+   by the compiler, the fewer false positives the warning is.  WORKLIST
+   is a vector of candidate phis to be examined.  ADDED_TO_WORKLIST is
    a pointer set tracking if the new phi is added to the worklist or not.  */
 
 static void
@@ -2337,7 +2298,7 @@ warn_uninitialized_phi (gphi *phi, vec<gphi *> *worklist,
 
   uninit_opnds = compute_uninit_opnds_pos (phi);
 
-  if  (MASK_EMPTY (uninit_opnds))
+  if (MASK_EMPTY (uninit_opnds))
     return;
 
   if (dump_file && (dump_flags & TDF_DETAILS))
@@ -2366,7 +2327,6 @@ warn_uninitialized_phi (gphi *phi, vec<gphi *> *worklist,
 	       SSA_NAME_VAR (uninit_op),
 	       "%qD may be used uninitialized in this function",
 	       uninit_use_stmt, loc);
-
 }
 
 static bool
@@ -2398,7 +2358,7 @@ public:
   {}
 
   /* opt_pass methods: */
-  opt_pass * clone () { return new pass_late_warn_uninitialized (m_ctxt); }
+  opt_pass *clone () { return new pass_late_warn_uninitialized (m_ctxt); }
   virtual bool gate (function *) { return gate_warn_uninitialized (); }
   virtual unsigned int execute (function *);
 
@@ -2439,8 +2399,7 @@ pass_late_warn_uninitialized::execute (function *fun)
 	for (i = 0; i < n; ++i)
 	  {
 	    tree op = gimple_phi_arg_def (phi, i);
-	    if (TREE_CODE (op) == SSA_NAME
-		&& uninit_undefined_value_p (op))
+	    if (TREE_CODE (op) == SSA_NAME && uninit_undefined_value_p (op))
 	      {
 		worklist.safe_push (phi);
 		added_to_worklist.add (phi);
@@ -2477,12 +2436,11 @@ make_pass_late_warn_uninitialized (gcc::context *ctxt)
   return new pass_late_warn_uninitialized (ctxt);
 }
 
-
 static unsigned int
 execute_early_warn_uninitialized (void)
 {
   /* Currently, this pass runs always but
-     execute_late_warn_uninitialized only runs with optimization. With
+     execute_late_warn_uninitialized only runs with optimization.  With
      optimization we want to warn about possible uninitialized as late
      as possible, thus don't do it here.  However, without
      optimization we need to warn here about "may be uninitialized".  */
@@ -2490,14 +2448,13 @@ execute_early_warn_uninitialized (void)
 
   warn_uninitialized_vars (/*warn_possibly_uninitialized=*/!optimize);
 
-  /* Post-dominator information can not be reliably updated. Free it
+  /* Post-dominator information can not be reliably updated.  Free it
      after the use.  */
 
   free_dominance_info (CDI_POST_DOMINATORS);
   return 0;
 }
 
-
 namespace {
 
 const pass_data pass_data_early_warn_uninitialized =
@@ -2523,9 +2480,9 @@ public:
   /* opt_pass methods: */
   virtual bool gate (function *) { return gate_warn_uninitialized (); }
   virtual unsigned int execute (function *)
-    {
-      return execute_early_warn_uninitialized ();
-    }
+  {
+    return execute_early_warn_uninitialized ();
+  }
 
 }; // class pass_early_warn_uninitialized
 
-- 
2.8.1


^ permalink raw reply	[flat|nested] 42+ messages in thread

* Re: [PATCH] Fix coding style in tree-ssa-uninit.c
  2016-05-06 10:06                           ` [PATCH] Fix coding style " Martin Liška
@ 2016-05-06 10:51                             ` Richard Biener
  0 siblings, 0 replies; 42+ messages in thread
From: Richard Biener @ 2016-05-06 10:51 UTC (permalink / raw)
  To: Martin Liška; +Cc: Bernd Schmidt, GCC Patches, Jeff Law

On Fri, May 6, 2016 at 12:06 PM, Martin Liška <mliska@suse.cz> wrote:
> On 11/26/2015 10:04 PM, Bernd Schmidt wrote:
>> As I said previously, the one to just replace whitespace is ok for now. Please ping the other one when stage1 opens (I expect it'll need changes by then).
>>
>>
>> Bernd
>
> Hello.
>
> This part of the part remains to be installed from the previous stage3.
> I've rebased the patch and rerun reg&bootstrap on x88_64-linux-gnu system.
>
> Ready to be installed?
Ok.

Richard.

> Thanks,
> Martin

^ permalink raw reply	[flat|nested] 42+ messages in thread

end of thread, other threads:[~2016-05-06 10:51 UTC | newest]

Thread overview: 42+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-11-09 11:22 [PATCH] Fix memory leaks and use a pool_allocator Martin Liška
2015-11-09 12:11 ` Richard Biener
2015-11-09 12:24   ` Trevor Saunders
2015-11-09 13:26   ` Martin Liška
2015-11-09 14:24     ` Richard Biener
2015-11-11 11:18       ` [PATCH] Fix PR rtl-optimization/68287 Martin Liška
2015-11-11 12:20         ` Richard Biener
2015-11-11 12:41           ` Martin Liška
2015-11-09 13:29 ` [PATCH] 02/N Fix memory leaks in IPA Martin Liška
2015-11-09 14:25   ` Richard Biener
2015-11-11  9:04 ` [PATCH 03/N] Just another set of memory leaks Martin Liška
2015-11-11 10:24   ` Richard Biener
2015-11-12 10:03 ` [PATCH 04/N] Fix big memory leak in ix86_valid_target_attribute_p Martin Liška
2015-11-12 11:29   ` Richard Biener
2015-11-12 11:33     ` Bernd Schmidt
2015-11-12 15:38       ` Martin Liška
2015-11-12 15:52     ` Martin Liška
2015-11-12 15:58       ` Ramana Radhakrishnan
2015-11-12 16:24         ` Martin Liška
2015-11-13 11:43 ` [PATCH 05/N] Fix memory leaks in graphite Martin Liška
2015-11-13 12:16   ` Richard Biener
2015-11-13 23:48     ` Sebastian Pop
2015-11-13 12:51 ` [PATCH] Fix memory leaks in tree-ssa-uninit.c Martin Liška
2015-11-13 16:32   ` Jeff Law
2015-11-13 16:58     ` Martin Liška
2015-11-13 19:19       ` Jeff Law
2015-11-18 14:23         ` Martin Liška
2015-11-18 16:59           ` Jeff Law
2015-11-19  0:50           ` Joseph Myers
2015-11-19  0:57             ` Bernd Schmidt
2015-11-19 10:17             ` Martin Liška
2015-11-19 13:58               ` Bernd Schmidt
2015-11-19 14:57                 ` Martin Liška
2015-11-20  2:14                   ` Bernd Schmidt
2015-11-20 11:15                     ` Martin Liška
2015-11-26 20:59                       ` Martin Liška
2015-11-26 21:08                         ` Bernd Schmidt
2016-05-06 10:06                           ` [PATCH] Fix coding style " Martin Liška
2016-05-06 10:51                             ` Richard Biener
2015-11-19 17:34                 ` [PATCH] Fix memory leaks " Jeff Law
2015-11-13 14:05 ` [PATCH 07/N] Fix memory leaks in haifa-sched Martin Liška
2015-11-13 16:08   ` Jeff Law

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).