[llvm] acf6072 - Reapply "[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 16:45:30 PST 2025
Author: Vasileios Porpodas
Date: 2025-01-15T16:38:37-08:00
New Revision: acf6072fae00123e78e362f74f0dc2d830837d10
URL: https://github.com/llvm/llvm-project/commit/acf6072fae00123e78e362f74f0dc2d830837d10
DIFF: https://github.com/llvm/llvm-project/commit/acf6072fae00123e78e362f74f0dc2d830837d10.diff
LOG: Reapply "[SandboxVec][Interval][NFC] Move a few definitions from header to .cpp"
This reverts commit 069fbeb82f56f0ce7c0382dfd5d4fa4dc1983a13.
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 922dd2c3a1f893..18cd29e9e14ee4 100644
--- a/llvm/include/llvm/Transforms/Vectorize/SandboxVectorizer/Interval.h
+++ b/llvm/include/llvm/Transforms/Vectorize/SandboxVectorizer/Interval.h
@@ -136,13 +136,7 @@ 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 {
- if (Other.empty())
- return true;
- if (empty())
- return true;
- return Other.Bottom->comesBefore(Top) || Bottom->comesBefore(Other.Top);
- }
+ bool disjoint(const Interval &Other) const;
/// \Returns the intersection between this and \p Other.
// Example:
// |----| this
@@ -232,23 +226,7 @@ template <typename T> class Interval {
}
#ifndef NDEBUG
- 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";
- }
+ void print(raw_ostream &OS) const;
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 79b37444195359..b2bfbf5c2e8b98 100644
--- a/llvm/lib/Transforms/Vectorize/SandboxVectorizer/Interval.cpp
+++ b/llvm/lib/Transforms/Vectorize/SandboxVectorizer/Interval.cpp
@@ -13,10 +13,36 @@
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
+
+template class Interval<Instruction>;
+template class Interval<MemDGNode>;
+
} // namespace llvm::sandboxir
More information about the llvm-commits
mailing list