[Bug tree-optimization/65136] New: VRP inserts unnecessary constant copy in the loop
izamyatin at gmail dot com
gcc-bugzilla@gcc.gnu.org
Fri Feb 20 09:56:00 GMT 2015
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65136
Bug ID: 65136
Summary: VRP inserts unnecessary constant copy in the loop
Product: gcc
Version: unknown
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: tree-optimization
Assignee: unassigned at gcc dot gnu.org
Reporter: izamyatin at gmail dot com
For the following piece of code
int foo (unsigned int cc)
{
while ( cc >> 16 )
{
cc = (cc & 0xffff) + (cc >> 16);
}
return cc == 1;
}
at o2 we have
movl %edi, %eax
shrl $16, %eax
testl %eax, %eax
je .L2
.p2align 4,,10
.p2align 3
.L3:
movzwl %di, %edi
addl %eax, %edi
movl $1, %eax
movl %edi, %edx
shrl $16, %edx
testl %edx, %edx
jne .L3
while with -fno-tree-vrp
jmp .L8
.p2align 4,,10
.p2align 3
.L3:
movzwl %di, %edi
addl %eax, %edi
.L8:
movl %edi, %eax
shrl $16, %eax
testl %eax, %eax
jne .L3
vrp changes loop in a following way
<bb 4>:
# cc_12 = PHI <cc_2(D)(3), cc_5(4)>
# _13 = PHI <_11(3), 1(4)>
_4 = cc_12 & 65535;
cc_5 = _13 + _4;
_3 = cc_5 >> 16;
if (_3 != 0)
goto <bb 4>;
else
goto <bb 5>;
resulted in constant copy to be inserted.
More information about the Gcc-bugs
mailing list