[PATCH] D50474: [LV] Vectorize header phis that feed from if-convertable latch phis
    Eli Friedman via Phabricator via llvm-commits 
    llvm-commits at lists.llvm.org
       
    Thu Aug  9 14:00:03 PDT 2018
    
    
  
efriedma added a comment.
Your patch miscompiles the following:
  void f(int n, int *p, int *z) {
  int x = 100;
  #pragma clang loop vectorize(enable)
  for (int i = 0; i < n; ++i) {
  if (p[i] > 0) x *= p[i];
  else x /= p[i];
  z[i]=x;
  }
  }
  typedef void fty(int,int*,int*);
  fty*volatile ff=f;
  int main() {
    int p[] = {1,-2,3,-4};
    int z[] = {1,2,3,4};
    ff(4, p, z);
    printf("%d %d %d %d\n", z[0], z[1], z[2], z[3]);
  }
Repository:
  rL LLVM
https://reviews.llvm.org/D50474
    
    
More information about the llvm-commits
mailing list