Issue 100864
Summary [LoopIdiomRecognize] Only optimization for initialize zero
Labels new issue
Assignees
Reporter vfdff
    * test: https://gcc.godbolt.org/z/zo3b9rMdj
```
void foo_memset0 (float dest[N], int n)
{
    // #pragma clang loop vectorize(assume_safety)
    for (int k=0; k<10; k++)
    for (int j = 0; j < n; j++) {
        dest[j] = 0;
    }
}

void foo_memset1 (float * __restrict dest, float * __restrict src, int n)
{
 // #pragma clang loop vectorize(assume_safety)
    for (int k=0; k<10; k++)
    for (int j = 0; j < n; j++) {
        dest[j] = 1;
 }
}
```

* We can see that there is obvious different output assembles between the initialize zero and initialize One.
  > For initialize zero, it is recognized as a memset , and then eliminate the out loop 
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to