diff mbox series

Fix up pre_and_rev_post_order_compute_fn

Message ID 20190207223729.GR2135@tucnak
State New
Headers show
Series Fix up pre_and_rev_post_order_compute_fn | expand

Commit Message

Jakub Jelinek Feb. 7, 2019, 10:37 p.m. UTC
Hi!

I've noticed pre_and_rev_post_order_compute_fn is one of (apparently many)
functions that take a struct function * argument and accept any function, as
long as it is cfun.  For a patch I've been working on I actually need it
to handle other functions as well and in this case it is trivial to fix.
I've seen several others e.g. in graph.c, though some of those are harder to
deal with, as some there are calls to functions that don't have a variant
with struct function * argument and assume cfun implicitly.

Bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk?

2019-02-07  Jakub Jelinek  <jakub@redhat.com>

	* cfganal.c (pre_and_rev_post_order_compute_fn): Use fn instead of
	cfun everywhere.


	Jakub

Comments

Richard Biener Feb. 8, 2019, 6:36 a.m. UTC | #1
On February 7, 2019 11:37:29 PM GMT+01:00, Jakub Jelinek <jakub@redhat.com> wrote:
>Hi!
>
>I've noticed pre_and_rev_post_order_compute_fn is one of (apparently
>many)
>functions that take a struct function * argument and accept any
>function, as
>long as it is cfun.  For a patch I've been working on I actually need
>it
>to handle other functions as well and in this case it is trivial to
>fix.
>I've seen several others e.g. in graph.c, though some of those are
>harder to
>deal with, as some there are calls to functions that don't have a
>variant
>with struct function * argument and assume cfun implicitly.
>
>Bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk?

EH... 

OK. 
Richard. 

>2019-02-07  Jakub Jelinek  <jakub@redhat.com>
>
>	* cfganal.c (pre_and_rev_post_order_compute_fn): Use fn instead of
>	cfun everywhere.
>
>--- gcc/cfganal.c.jj	2019-01-01 12:37:17.915962514 +0100
>+++ gcc/cfganal.c	2019-02-07 20:47:29.035520143 +0100
>@@ -951,10 +951,10 @@ pre_and_rev_post_order_compute_fn (struc
> 				   bool include_entry_exit)
> {
>   int pre_order_num = 0;
>-  int rev_post_order_num = n_basic_blocks_for_fn (cfun) - 1;
>+  int rev_post_order_num = n_basic_blocks_for_fn (fn) - 1;
> 
>   /* Allocate stack for back-tracking up CFG.  */
>-  auto_vec<edge_iterator, 20> stack (n_basic_blocks_for_fn (cfun) +
>1);
>+  auto_vec<edge_iterator, 20> stack (n_basic_blocks_for_fn (fn) + 1);
> 
>   if (include_entry_exit)
>     {
>@@ -968,7 +968,7 @@ pre_and_rev_post_order_compute_fn (struc
>     rev_post_order_num -= NUM_FIXED_BLOCKS;
> 
>   /* Allocate bitmap to track nodes that have been visited.  */
>-  auto_sbitmap visited (last_basic_block_for_fn (cfun));
>+  auto_sbitmap visited (last_basic_block_for_fn (fn));
> 
>   /* None of the nodes in the CFG have been visited yet.  */
>   bitmap_clear (visited);
>
>	Jakub
diff mbox series

Patch

--- gcc/cfganal.c.jj	2019-01-01 12:37:17.915962514 +0100
+++ gcc/cfganal.c	2019-02-07 20:47:29.035520143 +0100
@@ -951,10 +951,10 @@  pre_and_rev_post_order_compute_fn (struc
 				   bool include_entry_exit)
 {
   int pre_order_num = 0;
-  int rev_post_order_num = n_basic_blocks_for_fn (cfun) - 1;
+  int rev_post_order_num = n_basic_blocks_for_fn (fn) - 1;
 
   /* Allocate stack for back-tracking up CFG.  */
-  auto_vec<edge_iterator, 20> stack (n_basic_blocks_for_fn (cfun) + 1);
+  auto_vec<edge_iterator, 20> stack (n_basic_blocks_for_fn (fn) + 1);
 
   if (include_entry_exit)
     {
@@ -968,7 +968,7 @@  pre_and_rev_post_order_compute_fn (struc
     rev_post_order_num -= NUM_FIXED_BLOCKS;
 
   /* Allocate bitmap to track nodes that have been visited.  */
-  auto_sbitmap visited (last_basic_block_for_fn (cfun));
+  auto_sbitmap visited (last_basic_block_for_fn (fn));
 
   /* None of the nodes in the CFG have been visited yet.  */
   bitmap_clear (visited);