From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 1666) id ED646384782A; Tue, 25 May 2021 08:07:22 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org ED646384782A MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="utf-8" From: Richard Biener To: gcc-cvs@gcc.gnu.org Subject: [gcc r11-8464] ipa/100513 - fix SSA_NAME_DEF_STMT corruption in IPA param manip X-Act-Checkin: gcc X-Git-Author: Richard Biener X-Git-Refname: refs/heads/releases/gcc-11 X-Git-Oldrev: 3870fe246f442d795ef2270c74f56dda9d0be26c X-Git-Newrev: d0a8a95003e7763ece4886e771f71385966e229b Message-Id: <20210525080722.ED646384782A@sourceware.org> Date: Tue, 25 May 2021 08:07:22 +0000 (GMT) X-BeenThere: gcc-cvs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-cvs mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 25 May 2021 08:07:23 -0000 https://gcc.gnu.org/g:d0a8a95003e7763ece4886e771f71385966e229b commit r11-8464-gd0a8a95003e7763ece4886e771f71385966e229b Author: Richard Biener 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 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;