[llvm] [SandboxVec][DAG] Drop RAR and fix dependency scanning loop (PR #111715)
via llvm-commits
llvm-commits at lists.llvm.org
Wed Oct 9 10:09:55 PDT 2024
https://github.com/vporpo created https://github.com/llvm/llvm-project/pull/111715
None
>From a912652d952920a0ef915bbab670fc5d18936a0a Mon Sep 17 00:00:00 2001
From: Vasileios Porpodas <vporpodas at google.com>
Date: Wed, 9 Oct 2024 09:55:58 -0700
Subject: [PATCH] [SandboxVec][DAG] Drop RAR and fix dependency scanning loop
---
.../Vectorize/SandboxVectorizer/DependencyGraph.h | 1 -
.../SandboxVectorizer/DependencyGraph.cpp | 14 ++++++--------
2 files changed, 6 insertions(+), 9 deletions(-)
diff --git a/llvm/include/llvm/Transforms/Vectorize/SandboxVectorizer/DependencyGraph.h b/llvm/include/llvm/Transforms/Vectorize/SandboxVectorizer/DependencyGraph.h
index b1fe67d446be0a..134adc4b21ab12 100644
--- a/llvm/include/llvm/Transforms/Vectorize/SandboxVectorizer/DependencyGraph.h
+++ b/llvm/include/llvm/Transforms/Vectorize/SandboxVectorizer/DependencyGraph.h
@@ -173,7 +173,6 @@ class DependencyGraph {
enum class DependencyType {
ReadAfterWrite, ///> Memory dependency write -> read
WriteAfterWrite, ///> Memory dependency write -> write
- ReadAfterRead, ///> Memory dependency read -> read
WriteAfterRead, ///> Memory dependency read -> write
Control, ///> Control-related dependency, like with PHI/Terminator
Other, ///> Currently used for stack related instrs
diff --git a/llvm/lib/Transforms/Vectorize/SandboxVectorizer/DependencyGraph.cpp b/llvm/lib/Transforms/Vectorize/SandboxVectorizer/DependencyGraph.cpp
index 35ea28697424a6..81bc93b43af89a 100644
--- a/llvm/lib/Transforms/Vectorize/SandboxVectorizer/DependencyGraph.cpp
+++ b/llvm/lib/Transforms/Vectorize/SandboxVectorizer/DependencyGraph.cpp
@@ -62,8 +62,6 @@ DependencyGraph::getRoughDepType(Instruction *FromI, Instruction *ToI) {
} else if (FromI->mayReadFromMemory()) {
if (ToI->mayWriteToMemory())
return DependencyType::WriteAfterRead;
- if (ToI->mayReadFromMemory())
- return DependencyType::ReadAfterRead;
}
if (isa<sandboxir::PHINode>(FromI) || isa<sandboxir::PHINode>(ToI))
return DependencyType::Control;
@@ -103,7 +101,7 @@ bool DependencyGraph::alias(Instruction *SrcI, Instruction *DstI,
// TODO: Check AABudget
ModRefInfo SrcModRef =
isOrdered(SrcI)
- ? ModRefInfo::Mod
+ ? ModRefInfo::ModRef
: Utils::aliasAnalysisGetModRefInfo(*BatchAA, SrcI, *DstLocOpt);
switch (DepType) {
case DependencyType::ReadAfterWrite:
@@ -119,8 +117,6 @@ bool DependencyGraph::alias(Instruction *SrcI, Instruction *DstI,
bool DependencyGraph::hasDep(Instruction *SrcI, Instruction *DstI) {
DependencyType RoughDepType = getRoughDepType(SrcI, DstI);
switch (RoughDepType) {
- case DependencyType::ReadAfterRead:
- return false;
case DependencyType::ReadAfterWrite:
case DependencyType::WriteAfterWrite:
case DependencyType::WriteAfterRead:
@@ -174,9 +170,11 @@ Interval<Instruction> DependencyGraph::extend(ArrayRef<Instruction *> Instrs) {
}
// Create the dependencies.
auto DstRange = MemDGNodeIntervalBuilder::make(InstrInterval, *this);
- for (MemDGNode &DstN : drop_begin(DstRange)) {
- auto SrcRange = Interval<MemDGNode>(DstRange.top(), DstN.getPrevNode());
- scanAndAddDeps(DstN, SrcRange);
+ if (!DstRange.empty()) {
+ for (MemDGNode &DstN : drop_begin(DstRange)) {
+ auto SrcRange = Interval<MemDGNode>(DstRange.top(), DstN.getPrevNode());
+ scanAndAddDeps(DstN, SrcRange);
+ }
}
return InstrInterval;
More information about the llvm-commits
mailing list