This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug tree-optimization/42720] Problematic condition simplification logic at unswitch-loops pass
- From: "jingyu at google dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 29 Jan 2010 23:59:36 -0000
- Subject: [Bug tree-optimization/42720] Problematic condition simplification logic at unswitch-loops pass
- References: <bug-42720-17567@http.gcc.gnu.org/bugzilla/>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Comment #3 from jingyu at google dot com 2010-01-29 23:59 -------
You must set "--param max-unswitch-level=0" to trigger the bug in non-FDO use.
I just tried gcc-4.2.4 on X86 platform. The problem exists.
$ gcc loop.cpp -O3 --param max-unswitch-level=0 -m32 -S
testl %eax, %eax
jne .L5
xorl %eax, %eax
.p2align 4,,7
.L7:
addl $1, %eax <--- empty loop
cmpl %edx, %eax
jne .L7
xorl %ecx, %ecx
By default, max-unswitch-level is 3. So if you don't change max-unswitch-level,
after unswitch loop once, the conditions of nloop and loop can be simplified by
recursive calls.
Rather than writing a complicated test case which will do unswitch-loop 4
times, I would like to change the max-unswitch-level=0 to trigger the bug
early.
In FDO use, you can reproduce the bug with "-O2 -fprofile-use" on x86 with
gcc-4.4.0 or higher. I have checked gcc-4.2.x. The check "if
optimize_loop_for_size_p(loop)" is not in gcc-4.2.x. So gcc-4.2.x does not have
this problem in FDO use.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=42720