public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH 9/9] ipa: Avoid looking for IPA-SRA replacements where there are none
@ 2022-12-12 16:53 Martin Jambor
  2022-12-12 21:56 ` Jan Hubicka
  0 siblings, 1 reply; 2+ messages in thread
From: Martin Jambor @ 2022-12-12 16:53 UTC (permalink / raw)
  To: GCC Patches; +Cc: Jan Hubicka, Jan Hubicka

Hi,

I'm re-posting patches which I have posted at the end of stage 1 but
which have not passed review yet.

8<--------------------------------------------------------------------

While modifying the code, I realized that we do look into statements
even when there are no replacements.  This patch adds the necessary
early bail-outs to avoid that.

ipa_param_body_adjustments::modify_call_stmt cannot have the same at
the very beginning because calls can still contain otherwise removed
parameters that need to be removed from the statements too.

Bootstrapped and tested individually when I originally posted it and
now bootstrapped and LTO-bootstrapped and tested as part of the whole
series.  OK for master?


gcc/ChangeLog:

2022-11-11  Martin Jambor  <mjambor@suse.cz>

	* ipa-param-manipulation.cc
	(ipa_param_body_adjustments::modify_expression): Bail out early if
	there are no replacements.
	(ipa_param_body_adjustments::modify_assignment): Likewise.

gcc/testsuite/ChangeLog:

2022-11-11  Martin Jambor  <mjambor@suse.cz>

	PR ipa/103227
	PR ipa/107640
	* gcc.dg/ipa/pr107640-2.c: New test.
---
 gcc/ipa-param-manipulation.cc | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/gcc/ipa-param-manipulation.cc b/gcc/ipa-param-manipulation.cc
index e92cfc0b6d5..da19d64cbce 100644
--- a/gcc/ipa-param-manipulation.cc
+++ b/gcc/ipa-param-manipulation.cc
@@ -1762,6 +1762,8 @@ ipa_param_body_adjustments::modify_expression (tree *expr_p, bool convert)
 {
   tree expr = *expr_p;
 
+  if (m_replacements.is_empty ())
+    return false;
   if (TREE_CODE (expr) == BIT_FIELD_REF
       || TREE_CODE (expr) == IMAGPART_EXPR
       || TREE_CODE (expr) == REALPART_EXPR)
@@ -1809,7 +1811,7 @@ ipa_param_body_adjustments::modify_assignment (gimple *stmt,
   tree *lhs_p, *rhs_p;
   bool any;
 
-  if (!gimple_assign_single_p (stmt))
+  if (m_replacements.is_empty () || !gimple_assign_single_p (stmt))
     return false;
 
   rhs_p = gimple_assign_rhs1_ptr (stmt);
-- 
2.38.1


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

* Re: [PATCH 9/9] ipa: Avoid looking for IPA-SRA replacements where there are none
  2022-12-12 16:53 [PATCH 9/9] ipa: Avoid looking for IPA-SRA replacements where there are none Martin Jambor
@ 2022-12-12 21:56 ` Jan Hubicka
  0 siblings, 0 replies; 2+ messages in thread
From: Jan Hubicka @ 2022-12-12 21:56 UTC (permalink / raw)
  To: Martin Jambor; +Cc: GCC Patches

> Hi,
> 
> I'm re-posting patches which I have posted at the end of stage 1 but
> which have not passed review yet.
> 
> 8<--------------------------------------------------------------------
> 
> While modifying the code, I realized that we do look into statements
> even when there are no replacements.  This patch adds the necessary
> early bail-outs to avoid that.
> 
> ipa_param_body_adjustments::modify_call_stmt cannot have the same at
> the very beginning because calls can still contain otherwise removed
> parameters that need to be removed from the statements too.
> 
> Bootstrapped and tested individually when I originally posted it and
> now bootstrapped and LTO-bootstrapped and tested as part of the whole
> series.  OK for master?
> 
> 
> gcc/ChangeLog:
> 
> 2022-11-11  Martin Jambor  <mjambor@suse.cz>
> 
> 	* ipa-param-manipulation.cc
> 	(ipa_param_body_adjustments::modify_expression): Bail out early if
> 	there are no replacements.
> 	(ipa_param_body_adjustments::modify_assignment): Likewise.
> 
> gcc/testsuite/ChangeLog:
> 
> 2022-11-11  Martin Jambor  <mjambor@suse.cz>
> 
> 	PR ipa/103227
> 	PR ipa/107640
> 	* gcc.dg/ipa/pr107640-2.c: New test.
OK,
thanks!
Honza

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

end of thread, other threads:[~2022-12-12 21:56 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-12-12 16:53 [PATCH 9/9] ipa: Avoid looking for IPA-SRA replacements where there are none Martin Jambor
2022-12-12 21:56 ` Jan Hubicka

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).