Ineffective code after loop unrolling with -O3, ok with -Os

Hi all,

I found some issues during my testing of “loop unrolling” capabilities of LLVM’s opt.

Seems like LLVM generates slower code with -O3 since it wrongly decides to unroll a simple loop.
With option -Os, no loop unrolling, the output looks well.

Code:
https://godbolt.org/#g:!((g:!((g:!((h:codeEditor,i:(j:1,lang:c%2B%2B,source:‘%23include+%3Ccstdio%3E%0A%0Aint+f(void)%0A%7B%0A++int+n+%3D+100%3B%0A++while+(–n)+%7B%0A++++++puts(%22a%22)%3B%0A++%7D%0A++return+0%3B%0A%7D%0A%0Aint+main(void)+%7B%0A++++f()%3B%0A++++return+0%3B%0A%7D’),l:'5,version:4

Thanks

Fixed link: https://godbolt.org/g/2EqCKK