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: "rakdver at atrey dot karlin dot mff dot cuni dot cz" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 13 Jul 2006 09:03:59 -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 #24 from rakdver at atrey dot karlin dot mff dot cuni dot cz 2006-07-13 09:03 -------
Subject: Re: poor optimization choices when iterating over a std::string
(probably not c++-specific)
> > > However, ch isn't just copying the loop header; it is also
> > > copying the *entire body of the loop*, which nothing can fix. I call
> > > that a clear bug.
> >
> > how do you define a loop header?
>
> I was under the impression it was just the one basic block called out
> in the .ch dump, e.g.
>
> ;; Loop 1
> ;; header 6, latch 5
> ;; depth 1, level 1, outer 0
>
> -- basic block 6 happens to contain just the code from the syntactic
> loop condition. Andrew informs me that this is wrong, and that in
> this case the header is the entire loop, but I will come back at that
> with 'ch should never be duplicating the entire loop; if the header is
> the entire loop, it should do something more sensible, like duplicate
> just the first basic block or something.'
currently, we stop once the copied region is too large. This means that
on "normal" loops that have a body that does something, we won't copy
whole loop. Of course, any heuristics will have cases when it won't
perform ideally.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=28364