https://gcc.gnu.org/bugzilla/show_bug.cgi?id=54089
--- Comment #58 from Alexander Klepikov <klepikov.alex+bugs at gmail dot com> --- > Another thing ... the reason why it's desirable to expand into the libcall > earlier is to allow hoisting the function call address outside of loops and > things like that. Ouch. That's a real problem. Short loops can become slower on about 10%. But is it possible to detect a loop during expand pass? It looks like basic blocks have loop depth info, but I still don't now how to access a basic block. > That happens only once at the RTL level during > compilation and that's before the combine pass. Since there are no loops > around optimization passes in the compiler, it's always going to be a > compromise. But it might be OK to repeat a particular optimization pass > only for SH, if it helps anything. I would try that. I think loop optimiztion pass should be repeated after split pass. Do you know how to do it?