]> granicus.if.org Git - clang/commitdiff
Improve options printed on vectorization analysis diagnostics.
authorTyler Nowicki <tyler.nowicki@gmail.com>
Thu, 27 Aug 2015 18:58:34 +0000 (18:58 +0000)
committerTyler Nowicki <tyler.nowicki@gmail.com>
Thu, 27 Aug 2015 18:58:34 +0000 (18:58 +0000)
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

include/clang/Basic/DiagnosticFrontendKinds.td
test/Frontend/optimization-remark-options.c

index 0d61d8bc029c70802d5d47e8d2d12f0953699454..5af989825725b69aa2e3428f7596898fd8879884 100644 (file)
@@ -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<BackendOptimizationRemarkAnalysis>;
 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<BackendOptimizationRemarkAnalysis>;
 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<BackendOptimizationRemarkAnalysis>;
 def warn_fe_backend_optimization_failure : Warning<"%0">, BackendInfo,
index 0b649f169c0b958b1d30f48c5c5dd1715b415402..74fbeaf5d0c17db43cdbd95daa950eb3de734fd2 100644 (file)
@@ -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++) {