[Bug rtl-optimization/30545] New: Why does optimizer not move exp() out of loop
georg dot viehoever at web dot de
gcc-bugzilla@gcc.gnu.org
Mon Jan 22 17:01:00 GMT 2007
Hi,
I wonder why gcc does not move the constant exp() call from the inner loop to
the outer loop. Should I use different optimization settings?
Georg
Checked with g++ -O3 -S t.cpp; emacs t.S
t.cpp:
#include <cmath>
#include <iostream>
int main()
{
for (int i=0; i<10;++i)
{
for (int j=0; j<2;++j)
{
// this is constant for both runs of this loop
double res=exp(i);
std::cout<<"exp("<<i<<")="<<res<<std::endl;
}
}
return 0;
}
--
Summary: Why does optimizer not move exp() out of loop
Product: gcc
Version: 4.0.2
Status: UNCONFIRMED
Severity: minor
Priority: P3
Component: rtl-optimization
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: georg dot viehoever at web dot de
GCC host triplet: x86_64-unknown-linux-gnu
GCC target triplet: x86_64-unknown-linux-gnu
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=30545
More information about the Gcc-bugs
mailing list