diff options
author | Vladislav Ivanishin <vlad@ispras.ru> | 2019-10-07 14:29:07 +0000 |
---|---|---|
committer | Vladislav Ivanishin <vlad@gcc.gnu.org> | 2019-10-07 14:29:07 +0000 |
commit | 880dcdaedac453d2c64ebcc6f1bb5f81539c863c (patch) | |
tree | f4684d783c1f872f604ca1e3268f9d15df6cda6b /gcc/gimple-iterator.h | |
parent | ca95ce80e05143e64bca88ce5a6a38ee68894a95 (diff) | |
download | gcc-880dcdaedac453d2c64ebcc6f1bb5f81539c863c.zip gcc-880dcdaedac453d2c64ebcc6f1bb5f81539c863c.tar.gz gcc-880dcdaedac453d2c64ebcc6f1bb5f81539c863c.tar.bz2 |
Make gsi_next_nonvirtual_phi do what one expects
gcc/
* gimple-iterator.h (gsi_next_nonvirtual_phi): Change the semantics to
match that of other gsi_next_* functions. Adjust the comment.
(gsi_start_nonvirtual_phis): New function.
* ipa-icf.c (sem_function::compare_phi_node): Update uses of
gsi_next_nonvirtual_phi accordingly. (No functional change.)
From-SVN: r276658
Diffstat (limited to 'gcc/gimple-iterator.h')
-rw-r--r-- | gcc/gimple-iterator.h | 31 |
1 files changed, 17 insertions, 14 deletions
diff --git a/gcc/gimple-iterator.h b/gcc/gimple-iterator.h index ee6f5b1..ccd93d9 100644 --- a/gcc/gimple-iterator.h +++ b/gcc/gimple-iterator.h @@ -325,28 +325,31 @@ gsi_one_nondebug_before_end_p (gimple_stmt_iterator i) return gsi_end_p (i); } -/* Iterates I statement iterator to the next non-virtual statement. */ +/* Advance I statement iterator to the next non-virtual GIMPLE_PHI + statement. */ static inline void gsi_next_nonvirtual_phi (gphi_iterator *i) { - gphi *phi; - - if (gsi_end_p (*i)) - return; - - phi = i->phi (); - gcc_assert (phi != NULL); - - while (virtual_operand_p (gimple_phi_result (phi))) + do { gsi_next (i); + } + while (!gsi_end_p (*i) && virtual_operand_p (gimple_phi_result (i->phi ()))); +} - if (gsi_end_p (*i)) - return; +/* Return a new iterator pointing to the first non-virtual phi statement in + basic block BB. */ - phi = i->phi (); - } +static inline gphi_iterator +gsi_start_nonvirtual_phis (basic_block bb) +{ + gphi_iterator i = gsi_start_phis (bb); + + if (!gsi_end_p (i) && virtual_operand_p (gimple_phi_result (i.phi ()))) + gsi_next_nonvirtual_phi (&i); + + return i; } /* Return the basic block associated with this iterator. */ |