public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r11-8464] ipa/100513 - fix SSA_NAME_DEF_STMT corruption in IPA param manip
@ 2021-05-25  8:07 Richard Biener
  0 siblings, 0 replies; only message in thread
From: Richard Biener @ 2021-05-25  8:07 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:d0a8a95003e7763ece4886e771f71385966e229b

commit r11-8464-gd0a8a95003e7763ece4886e771f71385966e229b
Author: Richard Biener <rguenther@suse.de>
Date:   Tue May 11 13:23:45 2021 +0200

    ipa/100513 - fix SSA_NAME_DEF_STMT corruption in IPA param manip
    
    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.
    
    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.
    
    (cherry picked from commit 7e0fe7761da9255c9342788956c37b426875d872)

Diff:
---
 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 132bb24f76a..e11e36c2613 100644
--- a/gcc/ipa-param-manipulation.c
+++ b/gcc/ipa-param-manipulation.c
@@ -1688,7 +1688,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;


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2021-05-25  8:07 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-25  8:07 [gcc r11-8464] ipa/100513 - fix SSA_NAME_DEF_STMT corruption in IPA param manip Richard Biener

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