LoopVectorizer: Add support for if-conversion of PHINodes with 3+ incoming values.
authorNadav Rotem <nrotem@apple.com>
Fri, 3 May 2013 17:42:55 +0000 (17:42 +0000)
committerNadav Rotem <nrotem@apple.com>
Fri, 3 May 2013 17:42:55 +0000 (17:42 +0000)
commit4bcd5f888fa762613cf8096a79ba7b8a72665de2
tree1dfc096d2c67d5b3fbf51252b403f5ce3ebede39
parent19301d5d1234d032d42f20deb6f3076c972fd5f4
LoopVectorizer: Add support for if-conversion of PHINodes with 3+ incoming values.
By supporting the vectorization of PHINodes with more than two incoming values we can increase the complexity of nested if statements.

We can now vectorize this loop:

int foo(int *A, int *B, int n) {
  for (int i=0; i < n; i++) {
    int x = 9;
    if (A[i] > B[i]) {
      if (A[i] > 19) {
        x = 3;
      } else if (B[i] < 4 ) {
        x = 4;
      } else {
        x = 5;
      }
    }
    A[i] = x;
  }
}

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@181037 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Transforms/Vectorize/LoopVectorize.cpp
test/Transforms/LoopVectorize/if-conversion-nest.ll [new file with mode: 0644]