aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVladislav Ivanishin <vlad@ispras.ru>2019-10-07 14:29:07 +0000
committerVladislav Ivanishin <vlad@ispras.ru>2019-10-07 14:29:07 +0000
commit125c55e8a534b71dec2dd26d7ca6c63c7d707e73 (patch)
treef4684d783c1f872f604ca1e3268f9d15df6cda6b
parent6298755d69c5b81670561d6f9c1371d966c3aa88 (diff)
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.) git-svn-id: https://gcc.gnu.org/svn/gcc/trunk@276658 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r--gcc/ChangeLog8
-rw-r--r--gcc/gimple-iterator.h31
-rw-r--r--gcc/ipa-icf.c11
3 files changed, 29 insertions, 21 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 8ecb2a14812..2702146ef4b 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,5 +1,13 @@
2019-10-07 Vladislav Ivanishin <vlad@ispras.ru>
+ * 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.)
+
+2019-10-07 Vladislav Ivanishin <vlad@ispras.ru>
+
* doc/invoke.texi (-Wuninitialized): Don't mention the clobbered by
setjmp situation here. Fix a verb's ending: "the exact variables or
elements for which there are warnings depends" -> "... depend".
diff --git a/gcc/gimple-iterator.h b/gcc/gimple-iterator.h
index ee6f5b1f54d..ccd93d936be 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. */
diff --git a/gcc/ipa-icf.c b/gcc/ipa-icf.c
index 009aeb487dd..8bf0f7c6dd5 100644
--- a/gcc/ipa-icf.c
+++ b/gcc/ipa-icf.c
@@ -1688,13 +1688,10 @@ sem_function::compare_phi_node (basic_block bb1, basic_block bb2)
gcc_assert (bb1 != NULL);
gcc_assert (bb2 != NULL);
- si2 = gsi_start_phis (bb2);
- for (si1 = gsi_start_phis (bb1); !gsi_end_p (si1);
- gsi_next (&si1))
+ si2 = gsi_start_nonvirtual_phis (bb2);
+ for (si1 = gsi_start_nonvirtual_phis (bb1); !gsi_end_p (si1);
+ gsi_next_nonvirtual_phi (&si1))
{
- gsi_next_nonvirtual_phi (&si1);
- gsi_next_nonvirtual_phi (&si2);
-
if (gsi_end_p (si1) && gsi_end_p (si2))
break;
@@ -1731,7 +1728,7 @@ sem_function::compare_phi_node (basic_block bb1, basic_block bb2)
return return_false ();
}
- gsi_next (&si2);
+ gsi_next_nonvirtual_phi (&si2);
}
return true;