This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug rtl-optimization/30545] New: Why does optimizer not move exp() out of loop


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]