This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug tree-optimization/28364] poor optimization choices when iterating over a std::string (probably not c++-specific)
- From: "pinskia at gcc dot gnu dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 13 Jul 2006 03:45:11 -0000
- Subject: [Bug tree-optimization/28364] poor optimization choices when iterating over a std::string (probably not c++-specific)
- References: <bug-28364-37@http.gcc.gnu.org/bugzilla/>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Comment #15 from pinskia at gcc dot gnu dot org 2006-07-13 03:45 -------
One more comment, a loop with an early exit is whole issue and that is the
reason why all of the code in the loop is considered the header. There are a
couple of loop headers in this case, one for each exit which makes it harder to
deal with in general.
What you did not mention is which how would this loop exit normally, via the
return 1 or all the way through the loop. There is no enough information from
GCC's point of view to figure that out without profiling (for this case). GCC
is assuming that the loop exits in the first if statement which seems
reasoniable. Maybe you should try with profiling information and see what GCC
does for this testcase.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=28364