From: Tyler Nowicki Date: Thu, 27 Aug 2015 18:58:34 +0000 (+0000) Subject: Improve options printed on vectorization analysis diagnostics. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=39d0a05d24fbb5d3636c4790422b3f98b680b626;p=clang Improve options printed on vectorization analysis diagnostics. The LLVM patch changes the analysis diagnostics produced when loops with floating-point recurrences or memory operations are identified. The new messages say "cannot prove it is safe to reorder * operations; allow reordering by specifying #pragma clang loop vectorize(enable)". Depending on the type of diagnostic the message will include additional options such as ffast-math or __restrict__. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@246189 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/include/clang/Basic/DiagnosticFrontendKinds.td b/include/clang/Basic/DiagnosticFrontendKinds.td index 0d61d8bc02..5af9898257 100644 --- a/include/clang/Basic/DiagnosticFrontendKinds.td +++ b/include/clang/Basic/DiagnosticFrontendKinds.td @@ -46,13 +46,14 @@ def remark_fe_backend_optimization_remark_missed : Remark<"%0">, BackendInfo, def remark_fe_backend_optimization_remark_analysis : Remark<"%0">, BackendInfo, InGroup; def remark_fe_backend_optimization_remark_analysis_fpcommute : Remark<"%0; " - "allow commutativity by specifying '#pragma clang loop vectorize(enable)' " - "before the loop or by providing the compiler option '-ffast-math'">, + "allow reordering by specifying '#pragma clang loop vectorize(enable)' " + "before the loop or by providing the compiler option '-ffast-math'.">, BackendInfo, InGroup; def remark_fe_backend_optimization_remark_analysis_aliasing : Remark<"%0; " - "avoid runtime pointer checking when you know the arrays will always be " - "independent by specifying '#pragma clang loop vectorize(assume_safety)' " - "before the loop or by specifying 'restrict' on the array arguments. " + "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!">, BackendInfo, InGroup; def warn_fe_backend_optimization_failure : Warning<"%0">, BackendInfo, diff --git a/test/Frontend/optimization-remark-options.c b/test/Frontend/optimization-remark-options.c index 0b649f169c..74fbeaf5d0 100644 --- a/test/Frontend/optimization-remark-options.c +++ b/test/Frontend/optimization-remark-options.c @@ -1,6 +1,6 @@ // RUN: %clang -O1 -fvectorize -target x86_64-unknown-unknown -Rpass-analysis=loop-vectorize -emit-llvm -S %s -o - 2>&1 | FileCheck %s -// CHECK: {{.*}}:9:11: remark: loop not vectorized: vectorization requires changes in the order of operations, however IEEE 754 floating-point operations are not commutative; allow commutativity by specifying '#pragma clang loop vectorize(enable)' before the loop or by providing the compiler option '-ffast-math' +// CHECK: {{.*}}:9: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'. double foo(int N) { double v = 0.0; @@ -11,7 +11,7 @@ double foo(int N) { return v; } -// CHECK: {{.*}}:18:13: remark: loop not vectorized: cannot prove pointers refer to independent arrays in memory. The loop requires 9 runtime independence checks to vectorize the loop, but that would exceed the limit of 8 checks; avoid runtime pointer checking when you know the arrays will always be independent by specifying '#pragma clang loop vectorize(assume_safety)' before the loop or by specifying 'restrict' on the array arguments. Erroneous results will occur if these options are incorrectly applied! +// CHECK: {{.*}}:18:13: 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! void foo2(int *dw, int *uw, int *A, int *B, int *C, int *D, int N) { for (int i = 0; i < N; i++) {