public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
From: Richard Biener <rguenth@gcc.gnu.org>
To: gcc-cvs@gcc.gnu.org
Subject: [gcc r11-8464] ipa/100513 - fix SSA_NAME_DEF_STMT corruption in IPA param manip
Date: Tue, 25 May 2021 08:07:22 +0000 (GMT)	[thread overview]
Message-ID: <20210525080722.ED646384782A@sourceware.org> (raw)

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;


                 reply	other threads:[~2021-05-25  8:07 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210525080722.ED646384782A@sourceware.org \
    --to=rguenth@gcc.gnu.org \
    --cc=gcc-cvs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).