From 0de3f5dfdb1d6d593cb14bb502bedf63aca50c02 Mon Sep 17 00:00:00 2001
From: Tyler Nowicki <tnowicki@apple.com>
Date: Thu, 20 Aug 2015 16:19:43 -0700
Subject: [PATCH 3/4] Modify vectorization requirement diagnostics to use
 simplier concept of reordering.

---
 lib/Transforms/Vectorize/LoopVectorize.cpp     | 13 +++----------
 test/Transforms/LoopVectorize/X86/no_fpmath.ll |  2 +-
 test/Transforms/LoopVectorize/runtime-limit.ll |  6 +++---
 3 files changed, 7 insertions(+), 14 deletions(-)

diff --git a/lib/Transforms/Vectorize/LoopVectorize.cpp b/lib/Transforms/Vectorize/LoopVectorize.cpp
index 66a0868..13cc665 100644
--- a/lib/Transforms/Vectorize/LoopVectorize.cpp
+++ b/lib/Transforms/Vectorize/LoopVectorize.cpp
@@ -1510,10 +1510,8 @@ public:
         Hints.getWidth() == 0) {
       emitOptimizationRemarkAnalysisFPCommute(
           F->getContext(), Name, *F, UnsafeAlgebraInst->getDebugLoc(),
-          VectorizationReport() << "vectorization requires changes in the "
-                                   "order of operations, however IEEE 754 "
-                                   "floating-point operations are not "
-                                   "commutative");
+          VectorizationReport() << "cannot prove it is safe to reorder "
+                                   "floating-point operations");
       Failed = true;
     }
 
@@ -1522,12 +1520,7 @@ public:
       emitOptimizationRemarkAnalysisAliasing(
           F->getContext(), Name, *F, L->getStartLoc(),
           VectorizationReport()
-              << "cannot prove pointers refer to independent arrays in memory. "
-                 "The loop requires "
-              << NumRuntimePointerChecks
-              << " runtime independence checks to vectorize the loop, but that "
-                 "would exceed the limit of "
-              << VectorizerParams::RuntimeMemoryCheckThreshold << " checks");
+              << "cannot prove it is safe to reorder memory operations");
       DEBUG(dbgs() << "LV: Too many memory checks needed.\n");
       Failed = true;
     }
diff --git a/test/Transforms/LoopVectorize/X86/no_fpmath.ll b/test/Transforms/LoopVectorize/X86/no_fpmath.ll
index 2bfc32c..4981c3d 100644
--- a/test/Transforms/LoopVectorize/X86/no_fpmath.ll
+++ b/test/Transforms/LoopVectorize/X86/no_fpmath.ll
@@ -3,7 +3,7 @@
 ; RUN: opt < %s -loop-vectorize -mtriple=x86_64-unknown-linux -S -force-vectorization=1 2>&1 | FileCheck %s -check-prefix=NOANALYSIS
 ; RUN: opt < %s -loop-vectorize -mtriple=x86_64-unknown-linux -S -force-vectorization=1 -force-vector-width=1 2>&1 | FileCheck %s -check-prefix=NOANALYSIS
 
-; CHECK: remark: no_fpmath.c:6:11: loop not vectorized: vectorization requires changes in the order of operations, however IEEE 754 floating-point operations are not commutative
+; CHECK: remark: no_fpmath.c:6:11: loop not vectorized: cannot prove it is safe to reorder floating-point operations
 ; CHECK: remark: no_fpmath.c:6:14: loop not vectorized:
 ; CHECK: remark: no_fpmath.c:17:14: vectorized loop (vectorization width: 2, interleaved count: 2)
 
diff --git a/test/Transforms/LoopVectorize/runtime-limit.ll b/test/Transforms/LoopVectorize/runtime-limit.ll
index ff8d155..a2593eb 100644
--- a/test/Transforms/LoopVectorize/runtime-limit.ll
+++ b/test/Transforms/LoopVectorize/runtime-limit.ll
@@ -1,12 +1,12 @@
-; RUN: opt < %s  -loop-vectorize -force-vector-interleave=1 -force-vector-width=4 -dce -instcombine -pass-remarks=loop-vectorize -pass-remarks-missed=loop-vectorize -S 2>&1 | FileCheck %s
+; RUN: opt < %s -loop-vectorize -force-vector-interleave=1 -dce -instcombine -pass-remarks=loop-vectorize -pass-remarks-missed=loop-vectorize -S 2>&1 | FileCheck %s
 
 target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64-S128"
 target triple = "x86_64-apple-macosx10.8.0"
 
 ; First loop produced diagnostic pass remark.
-;CHECK: remark: {{.*}}:0:0: vectorized loop (vectorization width: 4, interleaved count: 1)
+;CHECK: remark: {{.*}}:0:0: vectorized loop (vectorization width: {{[0-9]}}, interleaved count: 1)
 ; Second loop produces diagnostic analysis remark.
-;CHECK: remark: {{.*}}:0:0: loop not vectorized: cannot prove pointers refer to independent arrays in memory. The loop requires 11 runtime independence checks to vectorize the loop, but that would exceed the limit of 8 checks
+;CHECK: remark: {{.*}}:0:0: loop not vectorized: cannot prove it is safe to reorder memory operations
 
 ; We are vectorizing with 6 runtime checks.
 ;CHECK-LABEL: func1x6(
-- 
2.3.2 (Apple Git-55)

