[Bug rtl-optimization/53252] New: Missed shrink wrapping opportunity
law at redhat dot com
gcc-bugzilla@gcc.gnu.org
Sun May 6 04:05:00 GMT 2012
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53252
Bug #: 53252
Summary: Missed shrink wrapping opportunity
Classification: Unclassified
Product: gcc
Version: unknown
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: rtl-optimization
AssignedTo: unassigned@gcc.gnu.org
ReportedBy: law@redhat.com
Compile the attached code with -O3 -fprofile-generate, run the resulting
executable, then compile again with -O3 -fprofile-use.
Ideally the fast path through main_func would just do something like
test %dil,%dil
jnz <slow path>
xor %eax,%eax
ret
Unfortunately, we're getting frame setup/teardown in the fast path.
testcode:
#include <stdio.h>
volatile long x = 13;
void bar(long v)
{
printf("l = %li\n", v);
}
long foo(long l)
{
for (int i = 0; i != x; ++i)
{
l *= l ^ 47110815;
bar(l);
}
return l;
}
int main_func(bool b) __attribute__((noinline));
int main_func(bool b)
{
int ret = 0;
if (b)
{
for ( int i = 0; i != 1000; ++i )
ret += foo(i);
}
return ret;
}
int main( int argc, char** argv)
{
return main_func(argc != 1);
}
More information about the Gcc-bugs
mailing list