Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / clang / test / Frontend / optimization-remark-options.c
blob96e480d140be8fa9863b3268aee8c36636306d53
1 // REQUIRES: x86-registered-target
2 // RUN: %clang -O1 -fvectorize -target x86_64-unknown-unknown -mllvm -vectorize-memory-check-threshold=8 -Rpass-analysis=loop-vectorize -emit-llvm -S %s -o - 2>&1 | FileCheck %s
4 // CHECK: {{.*}}:10:11: remark: loop not vectorized: cannot prove it is safe to reorder floating-point operations; allow reordering by specifying '#pragma clang loop vectorize(enable)' before the loop or by providing the compiler option '-ffast-math'.
6 double foo(int N) {
7 double v = 0.0;
9 for (int i = 0; i < N; i++)
10 v = v + 1.0;
12 return v;
15 // CHECK: {{.*}}:18:3: remark: loop not vectorized: cannot prove it is safe to reorder memory operations; allow reordering by specifying '#pragma clang loop vectorize(enable)' before the loop. If the arrays will always be independent specify '#pragma clang loop vectorize(assume_safety)' before the loop or provide the '__restrict__' qualifier with the independent array arguments. Erroneous results will occur if these options are incorrectly applied!
17 void foo2(int *dw, int *uw, int *A, int *B, int *C, int *D, int N) {
18 for (long i = 0; i < N; i++) {
19 dw[i] = A[i] + B[i - 1] + C[i - 2] + D[i - 3];
20 uw[i] = A[i] + B[i + 1] + C[i + 2] + D[i + 3];