aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Analysis/MemoryDependenceAnalysis.cpp
diff options
context:
space:
mode:
authorSergey Kachkov <sergey.kachkov@syntacore.com>2022-12-22 16:59:06 +0300
committerSergey Kachkov <sergey.kachkov@syntacore.com>2023-01-16 14:12:28 +0300
commitfc7cdaa373308ce3d72218b4d80101ae19850a6c (patch)
tree2fabfbd7ac787b95b34a892d2bc36ced58da6893 /llvm/lib/Analysis/MemoryDependenceAnalysis.cpp
parent355c547908aaac613e5615e91aeb37676e2f5129 (diff)
downloadllvm-fc7cdaa373308ce3d72218b4d80101ae19850a6c.zip
llvm-fc7cdaa373308ce3d72218b4d80101ae19850a6c.tar.gz
llvm-fc7cdaa373308ce3d72218b4d80101ae19850a6c.tar.bz2
[GVN] Refactor handling of pointer-select in GVN pass
This patch introduces new type of memory dependency - Select to consistently handle it like Def/Clobber dependency. Differential Revision: https://reviews.llvm.org/D141619
Diffstat (limited to 'llvm/lib/Analysis/MemoryDependenceAnalysis.cpp')
-rw-r--r--llvm/lib/Analysis/MemoryDependenceAnalysis.cpp7
1 files changed, 6 insertions, 1 deletions
diff --git a/llvm/lib/Analysis/MemoryDependenceAnalysis.cpp b/llvm/lib/Analysis/MemoryDependenceAnalysis.cpp
index 7a13e7a..960679b 100644
--- a/llvm/lib/Analysis/MemoryDependenceAnalysis.cpp
+++ b/llvm/lib/Analysis/MemoryDependenceAnalysis.cpp
@@ -592,6 +592,11 @@ MemDepResult MemoryDependenceResults::getSimplePointerDependencyFrom(
return MemDepResult::getDef(Inst);
}
+ // If we found a select instruction for MemLoc pointer, return it as
+ // Select dependency.
+ if (isa<SelectInst>(Inst) && MemLoc.Ptr == Inst)
+ return MemDepResult::getSelect(Inst);
+
if (isInvariantLoad)
continue;
@@ -962,7 +967,7 @@ MemDepResult MemoryDependenceResults::getNonLocalInfoForBlock(
// If the block has a dependency (i.e. it isn't completely transparent to
// the value), remember the reverse association because we just added it
// to Cache!
- if (!Dep.isDef() && !Dep.isClobber())
+ if (!Dep.isLocal())
return Dep;
// Keep the ReverseNonLocalPtrDeps map up to date so we can efficiently