https://gcc.gnu.org/bugzilla/show_bug.cgi?id=54089
--- Comment #59 from Oleg Endo <olegendo at gcc dot gnu.org> --- (In reply to Alexander Klepikov from comment #58) > > 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. There is 'BLOCK_FOR_INSN' But I'm not sure it will be helpful during the initial expand pass. > I would try that. I think loop optimiztion pass should be repeated after > split pass. Do you know how to do it? I don't know if we can simply repeat the loop optimizations. I think I've tried doing something like that before -- repeating some of the RTL passes, but without any useful results. It could also result in oscillations (pass A does a transformation, pass B undoes it, then pass A would do it again ...). Maybe you can get better results. There are already 2 SH specific passes 'sh_optimize_sett_clrt' and 'sh_treg_combine'. You can look at how they are instantiated and inserted into the RTL passes chain in 'register_sh_passes'. Maybe it's easier to add some shift specific passes.