aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Analysis/LoopAccessAnalysis.cpp
diff options
context:
space:
mode:
authorAllen <zhongyunde@huawei.com>2023-09-16 12:51:44 +0800
committerGitHub <noreply@github.com>2023-09-16 12:51:44 +0800
commit76c6a8bd36452bb6d17c650f8cd30c5cd5977bfc (patch)
treeba4a51ff597775f6c721928cfb6e350fbd529d6d /llvm/lib/Analysis/LoopAccessAnalysis.cpp
parent64c9dbbf4e82224a64dc878e2dc8f7d7541746eb (diff)
downloadllvm-76c6a8bd36452bb6d17c650f8cd30c5cd5977bfc.zip
llvm-76c6a8bd36452bb6d17c650f8cd30c5cd5977bfc.tar.gz
llvm-76c6a8bd36452bb6d17c650f8cd30c5cd5977bfc.tar.bz2
[LAA] Improve the output remark for LoopVectorize (#65832)
Don't report 'Use #pragma loop distribute(enable) to allow loop distribution' when we already add #pragma clang loop distribute(enable) Fixes https://github.com/llvm/llvm-project/issues/64637
Diffstat (limited to 'llvm/lib/Analysis/LoopAccessAnalysis.cpp')
-rw-r--r--llvm/lib/Analysis/LoopAccessAnalysis.cpp22
1 files changed, 17 insertions, 5 deletions
diff --git a/llvm/lib/Analysis/LoopAccessAnalysis.cpp b/llvm/lib/Analysis/LoopAccessAnalysis.cpp
index 4dd1504..8a779ac 100644
--- a/llvm/lib/Analysis/LoopAccessAnalysis.cpp
+++ b/llvm/lib/Analysis/LoopAccessAnalysis.cpp
@@ -2505,12 +2505,24 @@ void LoopAccessInfo::emitUnsafeDependenceRemark() {
LLVM_DEBUG(dbgs() << "LAA: unsafe dependent memory operations in loop\n");
// Emit remark for first unsafe dependence
+ bool HasForcedDistribution = false;
+ std::optional<const MDOperand *> Value =
+ findStringMetadataForLoop(TheLoop, "llvm.loop.distribute.enable");
+ if (Value) {
+ const MDOperand *Op = *Value;
+ assert(Op && mdconst::hasa<ConstantInt>(*Op) && "invalid metadata");
+ HasForcedDistribution = mdconst::extract<ConstantInt>(*Op)->getZExtValue();
+ }
+
+ const std::string Info =
+ HasForcedDistribution
+ ? "unsafe dependent memory operations in loop."
+ : "unsafe dependent memory operations in loop. Use "
+ "#pragma loop distribute(enable) to allow loop distribution "
+ "to attempt to isolate the offending operations into a separate "
+ "loop";
OptimizationRemarkAnalysis &R =
- recordAnalysis("UnsafeDep", Dep.getDestination(*this))
- << "unsafe dependent memory operations in loop. Use "
- "#pragma loop distribute(enable) to allow loop distribution "
- "to attempt to isolate the offending operations into a separate "
- "loop";
+ recordAnalysis("UnsafeDep", Dep.getDestination(*this)) << Info;
switch (Dep.Type) {
case MemoryDepChecker::Dependence::NoDep: