[llvm] 069fbeb - Revert "[SandboxVec][Interval][NFC] Move a few definitions from header to .cpp"

Vasileios Porpodas via llvm-commits llvm-commits at lists.llvm.org
Wed Jan 15 15:30:47 PST 2025


Author: Vasileios Porpodas
Date: 2025-01-15T15:30:19-08:00
New Revision: 069fbeb82f56f0ce7c0382dfd5d4fa4dc1983a13

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

LOG: Revert "[SandboxVec][Interval][NFC] Move a few definitions from header to .cpp"

This reverts commit 24c603505f91b2979d13e0b963fbd3c0174a005f.

Added: 
    

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

Removed: 
    


################################################################################
diff  --git a/llvm/include/llvm/Transforms/Vectorize/SandboxVectorizer/Interval.h b/llvm/include/llvm/Transforms/Vectorize/SandboxVectorizer/Interval.h
index 18cd29e9e14ee4..922dd2c3a1f893 100644
--- a/llvm/include/llvm/Transforms/Vectorize/SandboxVectorizer/Interval.h
+++ b/llvm/include/llvm/Transforms/Vectorize/SandboxVectorizer/Interval.h
@@ -136,7 +136,13 @@ template <typename T> class Interval {
     return bottom()->comesBefore(Other.top());
   }
   /// \Returns true if this and \p Other have nothing in common.
-  bool disjoint(const Interval &Other) const;
+  bool disjoint(const Interval &Other) const {
+    if (Other.empty())
+      return true;
+    if (empty())
+      return true;
+    return Other.Bottom->comesBefore(Top) || Bottom->comesBefore(Other.Top);
+  }
   /// \Returns the intersection between this and \p Other.
   // Example:
   // |----|   this
@@ -226,7 +232,23 @@ template <typename T> class Interval {
   }
 
 #ifndef NDEBUG
-  void print(raw_ostream &OS) const;
+  void print(raw_ostream &OS) const {
+    auto *Top = top();
+    auto *Bot = bottom();
+    OS << "Top: ";
+    if (Top != nullptr)
+      OS << *Top;
+    else
+      OS << "nullptr";
+    OS << "\n";
+
+    OS << "Bot: ";
+    if (Bot != nullptr)
+      OS << *Bot;
+    else
+      OS << "nullptr";
+    OS << "\n";
+  }
   LLVM_DUMP_METHOD void dump() const;
 #endif
 };

diff  --git a/llvm/lib/Transforms/Vectorize/SandboxVectorizer/Interval.cpp b/llvm/lib/Transforms/Vectorize/SandboxVectorizer/Interval.cpp
index 7822b304ce9bdb..79b37444195359 100644
--- a/llvm/lib/Transforms/Vectorize/SandboxVectorizer/Interval.cpp
+++ b/llvm/lib/Transforms/Vectorize/SandboxVectorizer/Interval.cpp
@@ -16,32 +16,7 @@ namespace llvm::sandboxir {
 template class Interval<Instruction>;
 template class Interval<MemDGNode>;
 
-template <typename T> bool Interval<T>::disjoint(const Interval &Other) const {
-  if (Other.empty())
-    return true;
-  if (empty())
-    return true;
-  return Other.Bottom->comesBefore(Top) || Bottom->comesBefore(Other.Top);
-}
-
 #ifndef NDEBUG
-template <typename T> void Interval<T>::print(raw_ostream &OS) const {
-  auto *Top = top();
-  auto *Bot = bottom();
-  OS << "Top: ";
-  if (Top != nullptr)
-    OS << *Top;
-  else
-    OS << "nullptr";
-  OS << "\n";
-
-  OS << "Bot: ";
-  if (Bot != nullptr)
-    OS << *Bot;
-  else
-    OS << "nullptr";
-  OS << "\n";
-}
 template <typename T> void Interval<T>::dump() const { print(dbgs()); }
 #endif
 } // namespace llvm::sandboxir


        


More information about the llvm-commits mailing list