diff --git gcc/testsuite/gcc.dg/vect/pr58508.c gcc/testsuite/gcc.dg/vect/pr58508.c new file mode 100644 index 0000000..cb22b50 --- /dev/null +++ gcc/testsuite/gcc.dg/vect/pr58508.c @@ -0,0 +1,20 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -ftree-vectorize -fdump-tree-vect-details" } */ + + +/* The GCC vectorizer generates loop versioning for the following loop + since there may exist aliasing between A and B. The predicate checks + if A may alias with B across all iterations. Then for the loop in + the true body, we can assert that *B is a loop invariant so that + we can hoist the load of *B before the loop body. */ + +void foo (int* a, int* b) +{ + int i; + for (i = 0; i < 100000; ++i) + a[i] = *b + 1; +} + + +/* { dg-final { scan-tree-dump-times "hoist" 2 "vect" } } */ +/* { dg-final { cleanup-tree-dump "vect" } } */