https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106077
--- Comment #2 from CVS Commits <cvs-commit at gcc dot gnu.org> --- The master branch has been updated by Jan Hubicka <hubi...@gcc.gnu.org>: https://gcc.gnu.org/g:b1f30bf42d8d47228e52de998f3172b2f5dd7265 commit r13-5215-gb1f30bf42d8d47228e52de998f3172b2f5dd7265 Author: Jan Hubicka <j...@suse.cz> Date: Mon Jan 16 18:14:45 2023 +0100 Fix wrong code issues with ipa-sra Fix wrong code issues in ipa-sra where we are trying to prove that on every execution of a given function a call to other function will happen. The code uses post dominators and makes a wrong query (which passes only for first BB in function). Hoever post-dominators are only valid if fake edges for every possible reason for fuction execution to terminate are added. Fixing this using postdominators is somewhat costy since one needs to walk whole body and add a lot of fake edges. I ended up implementing a special purpose function for this which is also useful in ipa-modref and other places that does similar analysis. One does not need to modify CFG to use it and moreover for complex functions it usually stops on first unanalyzed function call and ends up being relatively cheap. Bootstrapped/regtested x86_64-linux, plan to commit it shortly. gcc/ChangeLog: 2023-01-16 Jan Hubicka <hubi...@ucw.cz> PR ipa/106077 * ipa-modref.cc (modref_access_analysis::analyze): Use find_always_executed_bbs. * ipa-sra.cc (process_scan_results): Likewise. * ipa-utils.cc (stmt_may_terminate_function_p): New function. (find_always_executed_bbs): New function. * ipa-utils.h (stmt_may_terminate_function_p): Declare. (find_always_executed_bbs): Declare. gcc/testsuite/ChangeLog: 2023-01-16 Jan Hubicka <hubi...@ucw.cz> * g++.dg/tree-ssa/pr106077.C: New test.