[llvm] ee0e17a - [SandboxVec][DAG] Drop RAR and fix dependency scanning loop (#111715)

via llvm-commits llvm-commits at lists.llvm.org
Wed Oct 9 10:29:52 PDT 2024


Author: vporpo
Date: 2024-10-09T10:29:48-07:00
New Revision: ee0e17a4d8b42278ded1217e415073e8bce88b2a

URL: https://github.com/llvm/llvm-project/commit/ee0e17a4d8b42278ded1217e415073e8bce88b2a
DIFF: https://github.com/llvm/llvm-project/commit/ee0e17a4d8b42278ded1217e415073e8bce88b2a.diff

LOG: [SandboxVec][DAG] Drop RAR and fix dependency scanning loop (#111715)

Added: 
    

Modified: 
    llvm/include/llvm/Transforms/Vectorize/SandboxVectorizer/DependencyGraph.h
    llvm/lib/Transforms/Vectorize/SandboxVectorizer/DependencyGraph.cpp

Removed: 
    


################################################################################
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 b88b0e89b9e798..82f253d4c63231 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:
@@ -175,9 +171,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