[Bug tree-optimization/21712] missed optimization due with const function and pulling out of loops

Daniel Berlin dberlin@dberlin.org
Sun May 22 21:56:00 GMT 2005


On Sun, 2005-05-22 at 21:36 +0000, rakdver at gcc dot gnu dot org wrote:
> ------- Additional Comments From rakdver at gcc dot gnu dot org  2005-05-22 21:36 -------
> Do you still believe we should move gettype2 out of the loop???

Okay, let's compromise.
If i move cgraph do noreturn and infinite loop detection, so that we
know everything we can about do_something and gettype2 that is possible,
and we detect neither for do_something, are you still going to claim
that we shouldn't move it out of the loop?

ISTM that presuming a call in a loop is incredibly expensive seems
wrong, when that call is const. Your case seems the very extreme corner
case, not the common case.

People mark const on simple calls (remember, const can't read from
anything but readonly memory), not huge monster calls that do lots of
stuff.








More information about the Gcc-bugs mailing list