[PATCH] D92592: Fix layering issue by moving AliasScopeNode from ScopedNoAliasAA.h to Metadata.h
Di Mo via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Dec 3 11:02:26 PST 2020
modimo created this revision.
Herald added subscribers: llvm-commits, hoy, dexonsmith, wenlei, lxfind, hiraditya.
Herald added a project: LLVM.
modimo requested review of this revision.
@MaskRay pointed out that having Metadata.h include ScopedNoAliasAA.h introduces a layering issue. The fix is
to move the declaration of AliasScopeNode to Metadata.h which is already included by ScopedNoAliasAA.cpp and remove Metadata.h
including ScopedNoAliasAA.h
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D92592
Files:
llvm/include/llvm/Analysis/ScopedNoAliasAA.h
llvm/include/llvm/IR/Metadata.h
llvm/lib/IR/Metadata.cpp
Index: llvm/lib/IR/Metadata.cpp
===================================================================
--- llvm/lib/IR/Metadata.cpp
+++ llvm/lib/IR/Metadata.cpp
@@ -27,7 +27,6 @@
#include "llvm/ADT/StringMap.h"
#include "llvm/ADT/StringRef.h"
#include "llvm/ADT/Twine.h"
-#include "llvm/Analysis/ScopedNoAliasAA.h"
#include "llvm/IR/Argument.h"
#include "llvm/IR/BasicBlock.h"
#include "llvm/IR/Constant.h"
Index: llvm/include/llvm/IR/Metadata.h
===================================================================
--- llvm/include/llvm/IR/Metadata.h
+++ llvm/include/llvm/IR/Metadata.h
@@ -1105,6 +1105,27 @@
static MDNode *getMostGenericAlignmentOrDereferenceable(MDNode *A, MDNode *B);
};
+/// This is a simple wrapper around an MDNode which provides a higher-level
+/// interface by hiding the details of how scoped alias analysis information is
+/// encoded in its operands.
+class AliasScopeNode {
+ const MDNode *Node = nullptr;
+
+public:
+ AliasScopeNode() = default;
+ explicit AliasScopeNode(const MDNode *N) : Node(N) {}
+
+ /// Get the MDNode for this AliasScopeNode.
+ const MDNode *getNode() const { return Node; }
+
+ /// Get the MDNode for this AliasScopeNode's domain.
+ const MDNode *getDomain() const {
+ if (Node->getNumOperands() < 2)
+ return nullptr;
+ return dyn_cast_or_null<MDNode>(Node->getOperand(1));
+ }
+};
+
/// Tuple of metadata.
///
/// This is the simple \a MDNode arbitrary tuple. Nodes are uniqued by
Index: llvm/include/llvm/Analysis/ScopedNoAliasAA.h
===================================================================
--- llvm/include/llvm/Analysis/ScopedNoAliasAA.h
+++ llvm/include/llvm/Analysis/ScopedNoAliasAA.h
@@ -25,27 +25,6 @@
class MDNode;
class MemoryLocation;
-/// This is a simple wrapper around an MDNode which provides a higher-level
-/// interface by hiding the details of how alias analysis information is encoded
-/// in its operands.
-class AliasScopeNode {
- const MDNode *Node = nullptr;
-
-public:
- AliasScopeNode() = default;
- explicit AliasScopeNode(const MDNode *N) : Node(N) {}
-
- /// Get the MDNode for this AliasScopeNode.
- const MDNode *getNode() const { return Node; }
-
- /// Get the MDNode for this AliasScopeNode's domain.
- const MDNode *getDomain() const {
- if (Node->getNumOperands() < 2)
- return nullptr;
- return dyn_cast_or_null<MDNode>(Node->getOperand(1));
- }
-};
-
/// A simple AA result which uses scoped-noalias metadata to answer queries.
class ScopedNoAliasAAResult : public AAResultBase<ScopedNoAliasAAResult> {
friend AAResultBase<ScopedNoAliasAAResult>;
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D92592.309311.patch
Type: text/x-patch
Size: 2609 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20201203/683209d1/attachment.bin>
More information about the llvm-commits
mailing list