https://gcc.gnu.org/bugzilla/show_bug.cgi?id=117014

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|---                         |WORKSFORME

--- Comment #1 from Richard Biener <rguenth at gcc dot gnu.org> ---
As 'k' is arr1[i] + arr2[i] you can at most use vector gather to implement
data[i+k] vectorized but then you have

t.c:5:17: missed:   possible alias involving gather/scatter between *_5 and
data[_8]
t.c:4:22: missed:  bad data dependence.

altering the testcase slightly to

int data[100];
void f(int *arr1, int * __restrict arr2)
{
    for(int i = 0; i < 100; i++){
        arr2[i] = -arr1[i];
        int k = arr1[i] + arr2[i];
        data[i] = data[i + k] + 1;
    }
}

get's you the desired simplification k == 0.  Otherwise the store to arr2[i]
can alter arr1[i] since arr1 and arr2 can alias.
  • [Bug tree-optimization/1... 652023330028 at smail dot nju.edu.cn via Gcc-bugs
    • [Bug tree-optimizat... rguenth at gcc dot gnu.org via Gcc-bugs

Reply via email to