Displaying 2 results from an estimated 2 matches for "codeeditor".
2018 Apr 03
1
Ineffective code after loop unrolling with -O3, ok with -Os
...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
',n:'0',o:'C%2B%2B+source+%231...
2017 Nov 18
2
Is llvm capable of doing loop interchange optimization?
...ple of not cache
friendly loop like this:
#define N 100
void foo(int** __restrict__ a,
int** __restrict__ b)
{
for (int i = 0; i < N; ++i)
for (int j = 0; j < N; ++j)
a[j][i] += b[j][i];
}
link to compiler explorer:
https://gcc.godbolt.org/#g:!((g:!((g:!((h:codeEditor,i:(j:1,source:'%23define+N+100%0A%0Avoid+foo(int**+__restrict__+a,+%0A+++++++++int**+__restrict__+b)%0A%7B%0A++++for+(int+i+%3D+0%3B+i+%3C+N%3B+%2B%2Bi)%0A++++++++for+(int+j+%3D+0%3B+j+%3C+N%3B+%2B%2Bj)%0A++++++++++++a%5Bj%5D%5Bi%5D+%2B%3D+b%5Bj%5D%5Bi%5D%3B%0A%7D%0A%0Avoid+bar(int**+__restrict...