This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug tree-optimization/71661] [7 Regression] wrong code at -O3
- From: "law at redhat dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Tue, 04 Oct 2016 20:29:12 +0000
- Subject: [Bug tree-optimization/71661] [7 Regression] wrong code at -O3
- Auto-submitted: auto-generated
- References: <bug-71661-4@http.gcc.gnu.org/bugzilla/>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71661
--- Comment #6 from Jeffrey A. Law <law at redhat dot com> ---
As noted in my last comment, removal of a forwarder block may turn an
irreducible loop into a natural loop. The loop header for any such exposed
natural loop will not be recognized as a loop header by tree_forwarder_block_p
(which avoids forwarding through loop headers).
So the easiest way to fix this problem is check if a block is a loop header in
remove_forwarder_block* rather than just in tree_forwarder_block_p. This is
comparable to how we avoid infinite loops where we have this tidbit of code:
/* We check for infinite loops already in tree_forwarder_block_p.
However it may happen that the infinite loop is created
afterwards due to removal of forwarders. */
if (dest == bb)
return false;