]> git.ipfire.org Git - thirdparty/gcc.git/commit
ipa/109607 - properly gimplify conversions introduced by IPA param manipulation
authorRichard Biener <rguenther@suse.de>
Wed, 26 Apr 2023 11:05:44 +0000 (13:05 +0200)
committerRichard Biener <rguenther@suse.de>
Thu, 27 Apr 2023 10:29:47 +0000 (12:29 +0200)
commitd89e23f27215fcd822994fb2fad17fcd31eef5e1
tree9199ec4407f196f335187f222338531c8df56874
parent481281ccf41aa2bc596e548edaad4e57833f3340
ipa/109607 - properly gimplify conversions introduced by IPA param manipulation

The following addresses IPA param manipulation (through IPA SRA)
replacing

  BIT_FIELD_REF <*this_8(D), 8, 56>

with

  BIT_FIELD_REF <VIEW_CONVERT_EXPR<const struct profile_count>(ISRA.814), 8, 56>

which is supposed to be invalid GIMPLE (ISRA.814 is a register).
There's currently insufficient checking in place to catch this in the
IL verifier but I am working on that as part of fixing PR109594.

The solution for the particular testcase I am running into this is
to split the conversion to a separate stmt.  Generally the modification
phase is set up for this but the extra_stmts sequence isn't passed
around everywhere.  The following passes it to modify_expression
from modify_assignment when rewriting the RHS.

PR ipa/109607
* ipa-param-manipulation.h
(ipa_param_body_adjustments::modify_expression): Add extra_stmts
argument.
* ipa-param-manipulation.cc
(ipa_param_body_adjustments::modify_expression): Likewise.
When we need a conversion and the replacement is a register
split the conversion out.
(ipa_param_body_adjustments::modify_assignment): Pass
extra_stmts to RHS modify_expression.

* g++.dg/torture/pr109607.C: New testcase.
gcc/ipa-param-manipulation.cc
gcc/ipa-param-manipulation.h
gcc/testsuite/g++.dg/torture/pr109607.C [new file with mode: 0644]