This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug tree-optimization/34114] Missed optimization: cannot determine loop termination
- From: "lloyd at randombit dot net" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 16 Nov 2007 00:50:02 -0000
- Subject: [Bug tree-optimization/34114] Missed optimization: cannot determine loop termination
- References: <bug-34114-6477@http.gcc.gnu.org/bugzilla/>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Comment #2 from lloyd at randombit dot net 2007-11-16 00:50 -------
Is there be any way to modify the code such that GCC would have an easier time
seeing this? I tried using 'assert(rnd_to_2 % 2 == 0)' (since glibc's
__assert_fail is marked with noreturn I thought it might help), but that didn't
seem to have an effect.
Short background that might be relevant: the code this is derived from is doing
partial loop unrolling (8 iterations in the actual code) with a block of inline
asm inserted, and then another loop following that handles any slop. Would
rewriting the loop as
while(in >= 2)
{
in -= 2;
i += 2;
}
be likely to help? I see that it does with one particular version (4.1.2), but
I have no intuition if that is because the optimizer understands such loops
better or if it is just random luck.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=34114