[llvm] 9eb6572 - [LV] Add back CantReorderMemOps remark.
Florian Hahn via llvm-commits
llvm-commits at lists.llvm.org
Mon Jul 4 09:24:07 PDT 2022
Author: Florian Hahn
Date: 2022-07-04T17:23:47+01:00
New Revision: 9eb657278611665433d30fb37979d1df48af2ac8
URL: https://github.com/llvm/llvm-project/commit/9eb657278611665433d30fb37979d1df48af2ac8
DIFF: https://github.com/llvm/llvm-project/commit/9eb657278611665433d30fb37979d1df48af2ac8.diff
LOG: [LV] Add back CantReorderMemOps remark.
Add back remark unintentionally dropped by 644a965c1efef68f.
I will add a LV test separately, so we do not have to rely on a Clang
test to catch this.
Added:
Modified:
clang/test/Frontend/optimization-remark-options.c
llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
Removed:
################################################################################
diff --git a/clang/test/Frontend/optimization-remark-options.c b/clang/test/Frontend/optimization-remark-options.c
index 3509a388d0f6..96e480d140be 100644
--- a/clang/test/Frontend/optimization-remark-options.c
+++ b/clang/test/Frontend/optimization-remark-options.c
@@ -1,5 +1,5 @@
// REQUIRES: x86-registered-target
-// RUN: %clang -O1 -fvectorize -target x86_64-unknown-unknown -Rpass-analysis=loop-vectorize -emit-llvm -S %s -o - 2>&1 | FileCheck %s
+// 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
// 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'.
diff --git a/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp b/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
index c9e9136bbd3c..b48c3e18def5 100644
--- a/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
+++ b/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
@@ -10514,8 +10514,18 @@ bool LoopVectorizePass::processLoop(Loop *L) {
bool ForceVectorization =
Hints.getForce() == LoopVectorizeHints::FK_Enabled;
if (!ForceVectorization &&
- !areRuntimeChecksProfitable(Checks, VF, L, *PSE.getSE()))
+ !areRuntimeChecksProfitable(Checks, VF, L, *PSE.getSE())) {
+ ORE->emit([&]() {
+ return OptimizationRemarkAnalysisAliasing(
+ DEBUG_TYPE, "CantReorderMemOps", L->getStartLoc(),
+ L->getHeader())
+ << "loop not vectorized: cannot prove it is safe to reorder "
+ "memory operations";
+ });
+ LLVM_DEBUG(dbgs() << "LV: Too many memory checks needed.\n");
+ Hints.emitRemarkWithHints();
return false;
+ }
}
// Identify the diagnostic messages that should be produced.
More information about the llvm-commits
mailing list