]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
ipa/100513 - fix SSA_NAME_DEF_STMT corruption in IPA param manip
authorRichard Biener <rguenther@suse.de>
Tue, 11 May 2021 11:23:45 +0000 (13:23 +0200)
committerRichard Biener <rguenther@suse.de>
Tue, 11 May 2021 12:47:25 +0000 (14:47 +0200)
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.

gcc/ipa-param-manipulation.c

index 1d1e64f546a7685537f22993599d32987ade2b08..f2d9147665534d579ae95360b274318ba61eb767 100644 (file)
@@ -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;