[llvm-dev] Query on unswitching + vectorization

Gopalasubramanian, Ganesh via llvm-dev llvm-dev at lists.llvm.org
Thu May 10 22:44:57 PDT 2018


Hi,

I am going through analysis on unswitching + vectorization.
For the below test, llvm unswitches successfully but fails to vectorize the loop after unswitching.
Llvm bails out saying "Found an outside user" apparently which is the value of 'tmp'.

int i, w, x[1000], y[1000],tmp;
void fn()
{
  for (i = 0; i < 1000; i++) {
    if (w==1) {
        y[i] = 1; tmp = i*2;
    }
    else if (w==2) {
        y[i] = 2; tmp = i*4;
    }
    x[i] += y[i] + tmp;
  }
}

GCC vectorizes the loop after unswitching/if conversion. Request your help in vectorizing this loop.

Regards
Ganesh

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20180511/2f491824/attachment.html>


More information about the llvm-dev mailing list