public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH] ipa/100513 - fix SSA_NAME_DEF_STMT corruption in IPA param manip
@ 2021-05-11 11:27 Richard Biener
  2021-05-11 12:18 ` Martin Jambor
  0 siblings, 1 reply; 2+ messages in thread
From: Richard Biener @ 2021-05-11 11:27 UTC (permalink / raw)
  To: gcc-patches; +Cc: hubicka

This fixes unintended clobbering of SSA_NAME_DEF_STMT of the
cloned/inlined from SSA name during IPA parameter manipulation
of call stmt LHSs.  gimple_call_set_lhs adjusts SSA_NAME_DEF_STMT
of the lhs to the stmt being modified but when
ipa_param_body_adjustments::modify_call_stmt is called the
cloning/inlining process has not yet remapped the stmts operands
to the copy variants but they are still original.

Bootstrapped on x86_64-unknown-linux-gnu, testing in progress.

OK for trunk and branch?

Thanks,
Richard.

2021-05-11  Richard Biener  <rguenther@suse.de>

	PR ipa/100513
	* ipa-param-manipulation.c
	(ipa_param_body_adjustments::modify_call_stmt): Avoid
	altering SSA_NAME_DEF_STMT by adjusting the calls LHS
	via gimple_call_lhs_ptr.
---
 gcc/ipa-param-manipulation.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/gcc/ipa-param-manipulation.c b/gcc/ipa-param-manipulation.c
index 1d1e64f546a..f2d91476655 100644
--- a/gcc/ipa-param-manipulation.c
+++ b/gcc/ipa-param-manipulation.c
@@ -1692,7 +1692,9 @@ ipa_param_body_adjustments::modify_call_stmt (gcall **stmt_p)
       if (tree lhs = gimple_call_lhs (stmt))
 	{
 	  modify_expression (&lhs, false);
-	  gimple_call_set_lhs (new_stmt, lhs);
+	  /* Avoid adjusting SSA_NAME_DEF_STMT of a SSA lhs, SSA names
+	     have not yet been remapped.  */
+	  *gimple_call_lhs_ptr (new_stmt) = lhs;
 	}
       *stmt_p = new_stmt;
       return true;
-- 
2.26.2

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

* Re: [PATCH] ipa/100513 - fix SSA_NAME_DEF_STMT corruption in IPA param manip
  2021-05-11 11:27 [PATCH] ipa/100513 - fix SSA_NAME_DEF_STMT corruption in IPA param manip Richard Biener
@ 2021-05-11 12:18 ` Martin Jambor
  0 siblings, 0 replies; 2+ messages in thread
From: Martin Jambor @ 2021-05-11 12:18 UTC (permalink / raw)
  To: Richard Biener; +Cc: hubicka, GCC Patches

Hi,

On Tue, May 11 2021, Richard Biener wrote:
> This fixes unintended clobbering of SSA_NAME_DEF_STMT of the
> cloned/inlined from SSA name during IPA parameter manipulation
> of call stmt LHSs.  gimple_call_set_lhs adjusts SSA_NAME_DEF_STMT
> of the lhs to the stmt being modified but when
> ipa_param_body_adjustments::modify_call_stmt is called the
> cloning/inlining process has not yet remapped the stmts operands
> to the copy variants but they are still original.
>
> Bootstrapped on x86_64-unknown-linux-gnu, testing in progress.
>
> OK for trunk and branch?

Yes, thank you.

Martin


>
> Thanks,
> Richard.
>
> 2021-05-11  Richard Biener  <rguenther@suse.de>
>
> 	PR ipa/100513
> 	* ipa-param-manipulation.c
> 	(ipa_param_body_adjustments::modify_call_stmt): Avoid
> 	altering SSA_NAME_DEF_STMT by adjusting the calls LHS
> 	via gimple_call_lhs_ptr.


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

end of thread, other threads:[~2021-05-11 12:18 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-11 11:27 [PATCH] ipa/100513 - fix SSA_NAME_DEF_STMT corruption in IPA param manip Richard Biener
2021-05-11 12:18 ` Martin Jambor

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