https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107692
--- Comment #9 from Hongyu Wang <wwwhhhyyy333 at gmail dot com> --- (In reply to Segher Boessenkool from comment #8) > (In reply to Jiu Fu Guo from comment #5) > > > -munroll-only-small-loops does not turn on or off -funroll-loops, and it > > > should not, so that it does what it says, if nothing else. > > > > Yes, and -funroll-loops would win over -munroll-only-small-loops > > -funroll-loops is the only thing that enables loop unrolling. > -munroll-only-small-loops, like the name says, says to only unroll small > loops, > and no others. It is not something at the same level as -funroll-loops, that > would be insanity: other code likes to see if the user requested loops to be > unrolled as well! I can understand the logic, my initial patch https://gcc.gnu.org/pipermail/gcc-patches/2022-October/604345.html is something similar to rs6000 and x86 only. The difference is, -mno-unroll-only-small-loops -O2 would cause rtl-loop-unroll takeing effect, and cunroll will also work if we follow the rs6000 change. We do not really want these so the patch becomes ugly as said :( I think the intension of -munroll-only-small-loops is to just adjust rtl-loop-unrolling and do not touch middle-end unroll/cunroll. But I think your point is also reasonable. Maybe we can split the flag_unroll_loops to tree and rtl seperately? Anyway I will propose a patch and re-discuss with maintainers later. Thanks!