ipa-sra: Don't consider CLOBBERS as writes preventing splitting
When IPA-SRA detects whether a parameter passed by reference is written to, it does not special case CLOBBERs which means it often bails out unnecessarily, especially when dealing with C++ destructors. Fixed by the obvious continue in the two relevant loops and by adding a simple function that marks the clobbers in the transformation code as statements to be removed. gcc/ChangeLog: 2023-08-04 Martin Jambor <mjambor@suse.cz> PR ipa/110378 * ipa-param-manipulation.h (class ipa_param_body_adjustments): New members get_ddef_if_exists_and_is_used and mark_clobbers_dead. * ipa-sra.cc (isra_track_scalar_value_uses): Ignore clobbers. (ptr_parm_has_nonarg_uses): Likewise. * ipa-param-manipulation.cc (ipa_param_body_adjustments::get_ddef_if_exists_and_is_used): New. (ipa_param_body_adjustments::mark_dead_statements): Move initial checks to get_ddef_if_exists_and_is_used. (ipa_param_body_adjustments::mark_clobbers_dead): New. (ipa_param_body_adjustments::common_initialization): Call mark_clobbers_dead when splitting. gcc/testsuite/ChangeLog: 2023-07-31 Martin Jambor <mjambor@suse.cz> PR ipa/110378 * g++.dg/ipa/pr110378-1.C: New test.
Showing
- gcc/ipa-param-manipulation.cc 40 additions, 4 deletionsgcc/ipa-param-manipulation.cc
- gcc/ipa-param-manipulation.h 2 additions, 0 deletionsgcc/ipa-param-manipulation.h
- gcc/ipa-sra.cc 4 additions, 2 deletionsgcc/ipa-sra.cc
- gcc/testsuite/g++.dg/ipa/pr110378-1.C 48 additions, 0 deletionsgcc/testsuite/g++.dg/ipa/pr110378-1.C
Loading
Please register or sign in to comment