<div dir="ltr">Fixed link: <a href="https://godbolt.org/g/2EqCKK">https://godbolt.org/g/2EqCKK</a></div><div class="gmail_extra"><br><div class="gmail_quote">2018-04-03 18:15 GMT+02:00 Dávid Bolvanský <span dir="ltr"><<a href="mailto:david.bolvansky@gmail.com" target="_blank">david.bolvansky@gmail.com</a>></span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><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" target="_blank">https://godbolt.org/#g:!((g:!(<wbr>(g:!((h:codeEditor,i:(j:1,<wbr>lang:c%2B%2B,source:'%<wbr>23include+%3Ccstdio%3E%0A%<wbr>0Aint+f(void)%0A%7B%0A++int+n+<wbr>%3D+100%3B%0A++while+(--n)+%<wbr>7B%0A++++++puts(%22a%22)%3B%<wbr>0A++%7D%0A++return+0%3B%0A%7D%<wbr>0A%0Aint+main(void)+%7B%0A++++<wbr>f()%3B%0A++++return+0%3B%0A%<wbr>7D'),l:'5</a>',n:'0',o:'C%2B%2B+<wbr>source+%231',t:'0')),k:33.<wbr>61947345592715,l:'4',n:'0',o:'<wbr>',s:0,t:'0'),(g:!((h:compiler,<wbr>i:(compiler:g73,filters:(b:'0'<wbr>,binary:'1',commentOnly:'0',<wbr>demangle:'0',directives:'0',<wbr>execute:'1',intel:'0',trim:'0'<wbr>),lang:c%2B%2B,libs:!(),<wbr>options:'-O3',source:1),l:'5',<wbr>n:'0',o:'x86-64+gcc+7.3+(<wbr>Editor+%231,+Compiler+%231)+C%<wbr>2B%2B',t:'0')),header:(),k:33.<wbr>04719321073953,l:'4',n:'0',o:'<wbr>',s:0,t:'0'),(g:!((h:compiler,<wbr>i:(compiler:clang600,filters:(<wbr>b:'0',binary:'1',commentOnly:'<wbr>0',demangle:'0',directives:'0'<wbr>,execute:'1',intel:'0',trim:'<wbr>0'),lang:c%2B%2B,libs:!(),<wbr>options:'-O3',source:1),l:'5',<wbr>n:'0',o:'x86-64+clang+6.0.0+(<wbr>Editor+%231,+Compiler+%232)+C%<wbr>2B%2B',t:'0')),k:33.<wbr>33333333333333,l:'4',n:'0',o:'<wbr>',s:0,t:'0')),l:'2',n:'0',o:''<wbr>,t:'0')),version:4<br></div><div><br></div><div>Thanks</div></div>
</blockquote></div><br></div>