<div dir="ltr">Hi all,<div><br></div><div>I found some issues during my testing of "loop unrolling" capabilities of LLVM's opt.</div><div><br></div><div>Seems like LLVM generates slower code with -O3 since it wrongly decides to unroll a simple loop.</div><div>With option -Os, no loop unrolling, the output looks well.</div><div><br></div><div>Code:</div><div><a href="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">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</a>',n:'0',o:'C%2B%2B+source+%231',t:'0')),k:33.61947345592715,l:'4',n:'0',o:'',s:0,t:'0'),(g:!((h:compiler,i:(compiler:g73,filters:(b:'0',binary:'1',commentOnly:'0',demangle:'0',directives:'0',execute:'1',intel:'0',trim:'0'),lang:c%2B%2B,libs:!(),options:'-O3',source:1),l:'5',n:'0',o:'x86-64+gcc+7.3+(Editor+%231,+Compiler+%231)+C%2B%2B',t:'0')),header:(),k:33.04719321073953,l:'4',n:'0',o:'',s:0,t:'0'),(g:!((h:compiler,i:(compiler:clang600,filters:(b:'0',binary:'1',commentOnly:'0',demangle:'0',directives:'0',execute:'1',intel:'0',trim:'0'),lang:c%2B%2B,libs:!(),options:'-O3',source:1),l:'5',n:'0',o:'x86-64+clang+6.0.0+(Editor+%231,+Compiler+%232)+C%2B%2B',t:'0')),k:33.33333333333333,l:'4',n:'0',o:'',s:0,t:'0')),l:'2',n:'0',o:'',t:'0')),version:4<br></div><div><br></div><div>Thanks</div></div>