Hi, this patch series addresses PR 93385 which exposed that the new IPA-SRA depends on tree-dce and can leave misbehaving instructions behind if the user switched it off. It is a series because I also tried to produce the best debug info possible in such cases while avoiding unnecessary copying of instructions during IPA-SRA clone materialization and it seemed best to tackle different problems independently. We also might not want to backport all of the patches to GCC 10.
The first patch actually fixes similar but different PR 95113 where IPA-SRA should switch itself off because of non-call exceptions. The second patch fixes non-debug instructions in PR 93385, debug instructions are simply reset. The third patch fixes up debug statements except for those when a removed value is passed to another function. The fourth patch attempts to produce useful debug info even in this situation and fixes PR debug/95343. However it requires relaxing some gimple IL rules during IPA passes (and only during IPA passes). After/if there is a consensus on the above, I would like to proceed with a little bit of clean-up in the messy parts of tree-inline.c which are directly involved in this - particularly the debug info generation. Finally, in Bugzilla Jakub asked me to make IPA-SRA consider any arithmetic operation on otherwise unnecessary argument a use - if the user used the option -fno-tree-dce. I have not done that yet, mostly because I realized we already differentiate between -fno-dce and -fno-tree-dce and so none of those options is really for users and GCC hackers might want to disable a specific pass and not a little bit of another when they use it. Also, making the testcase fail without -fno-tree-dce requires using the following exact combination of options: -fno-dce -fdisable-tree-cddce1 -fdisable-tree-cdce -fdisable-tree-cddce3 -fdisable-tree-dce2 -fdisable-tree-dce3 -fdisable-tree-dce4 -fdisable-tree-dce7 And that does not seem very maintainable in the testcase. Nevertheless, if the consensus is that -fno-tree-dce should also limit IPA-SRA in this regard, the patch is trivial (Jakup wrote it in comment 23. All patches were individually bootstrapped and tested on x86_64-linux and the whole bundle also passes LTO bootstrap and profiled-LTO bootstrap on the same platform. Bootstrap on aarch64 and i686 is underway. I am looking forward for your comments, questions and suggestions, Martin Martin Jambor (4): ipa-sra: Do not remove statements necessary because of non-call EH (PR 95113) ipa-sra: Introduce a mini-DCE to tree-inline.c (PR 93385) ipa-sra: Improve debug info for removed parameters (PR 93385) ipa-sra: Fix debug info for removed args passed to other functions (PR 93385, 95343) gcc/ipa-param-manipulation.c | 406 +++++++++++++++++++---- gcc/ipa-param-manipulation.h | 18 + gcc/ipa-sra.c | 28 +- gcc/testsuite/gcc.dg/guality/ipa-sra-1.c | 45 +++ gcc/testsuite/gcc.dg/guality/pr95343.c | 45 +++ gcc/testsuite/gcc.dg/ipa/ipa-sra-23.c | 24 ++ gcc/testsuite/gcc.dg/ipa/pr93385.c | 27 ++ gcc/testsuite/gcc.dg/ipa/pr95113.c | 33 ++ gcc/tree-cfg.c | 14 +- gcc/tree-eh.c | 10 + gcc/tree-eh.h | 1 + gcc/tree-inline.c | 51 ++- gcc/tree-ssa-dce.c | 4 +- gcc/tree-ssa-operands.c | 16 +- 14 files changed, 635 insertions(+), 87 deletions(-) create mode 100644 gcc/testsuite/gcc.dg/guality/ipa-sra-1.c create mode 100644 gcc/testsuite/gcc.dg/guality/pr95343.c create mode 100644 gcc/testsuite/gcc.dg/ipa/ipa-sra-23.c create mode 100644 gcc/testsuite/gcc.dg/ipa/pr93385.c create mode 100644 gcc/testsuite/gcc.dg/ipa/pr95113.c -- 2.26.2