From: Richard Biener Date: Tue, 11 May 2021 11:23:45 +0000 (+0200) Subject: ipa/100513 - fix SSA_NAME_DEF_STMT corruption in IPA param manip X-Git-Tag: releases/gcc-11.2.0~338 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d0a8a95003e7763ece4886e771f71385966e229b;p=thirdparty%2Fgcc.git 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 --git a/gcc/ipa-param-manipulation.c b/gcc/ipa-param-manipulation.c index 132bb24f76aa..e11e36c2613e 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;