[llvm] 2d1ffad - [IR] Re-group AAMDNodes relevant interfaces. NFC.

Michael Liao via llvm-commits llvm-commits at lists.llvm.org
Tue Sep 21 11:31:29 PDT 2021


Author: Michael Liao
Date: 2021-09-21T14:29:33-04:00
New Revision: 2d1ffad01074cdfa6e986c526167b600cf71eb41

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

LOG: [IR] Re-group AAMDNodes relevant interfaces. NFC.

Added: 
    

Modified: 
    llvm/include/llvm/IR/Instruction.h
    llvm/lib/Analysis/TypeBasedAliasAnalysis.cpp
    llvm/lib/IR/Metadata.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/include/llvm/IR/Instruction.h b/llvm/include/llvm/IR/Instruction.h
index 15a4048090d0..88d33f3c8adb 100644
--- a/llvm/include/llvm/IR/Instruction.h
+++ b/llvm/include/llvm/IR/Instruction.h
@@ -307,9 +307,6 @@ class Instruction : public User,
     Value::getAllMetadata(MDs);
   }
 
-  /// Returns the AA metadata for this instruction.
-  AAMDNodes getAAMetadata() const;
-
   /// Set the metadata of the specified kind to the specified node. This updates
   /// or replaces metadata if already present, or removes it if Node is null.
   void setMetadata(unsigned KindID, MDNode *Node);
@@ -350,7 +347,10 @@ class Instruction : public User,
   /// to the existing node.
   void addAnnotationMetadata(StringRef Annotation);
 
-  /// Sets the metadata on this instruction from the AAMDNodes structure.
+  /// Returns the AA metadata for this instruction.
+  AAMDNodes getAAMetadata() const;
+
+  /// Sets the AA metadata on this instruction from the AAMDNodes structure.
   void setAAMetadata(const AAMDNodes &N);
 
   /// Retrieve the raw weight values of a conditional branch or select.

diff  --git a/llvm/lib/Analysis/TypeBasedAliasAnalysis.cpp b/llvm/lib/Analysis/TypeBasedAliasAnalysis.cpp
index f52dea3bd915..23dbb32f38de 100644
--- a/llvm/lib/Analysis/TypeBasedAliasAnalysis.cpp
+++ b/llvm/lib/Analysis/TypeBasedAliasAnalysis.cpp
@@ -538,15 +538,6 @@ AAMDNodes AAMDNodes::concat(const AAMDNodes &Other) const {
   return Result;
 }
 
-AAMDNodes Instruction::getAAMetadata() const {
-  AAMDNodes Result;
-  Result.TBAA = getMetadata(LLVMContext::MD_tbaa);
-  Result.TBAAStruct = getMetadata(LLVMContext::MD_tbaa_struct);
-  Result.Scope = getMetadata(LLVMContext::MD_alias_scope);
-  Result.NoAlias = getMetadata(LLVMContext::MD_noalias);
-  return Result;
-}
-
 static const MDNode *createAccessTag(const MDNode *AccessType) {
   // If there is no access type or the access type is the root node, then
   // we don't have any useful access tag to return.

diff  --git a/llvm/lib/IR/Metadata.cpp b/llvm/lib/IR/Metadata.cpp
index 4f87ef537765..01bfff84f0c7 100644
--- a/llvm/lib/IR/Metadata.cpp
+++ b/llvm/lib/IR/Metadata.cpp
@@ -1367,6 +1367,15 @@ void Instruction::addAnnotationMetadata(StringRef Name) {
   setMetadata(LLVMContext::MD_annotation, MD);
 }
 
+AAMDNodes Instruction::getAAMetadata() const {
+  AAMDNodes Result;
+  Result.TBAA = getMetadata(LLVMContext::MD_tbaa);
+  Result.TBAAStruct = getMetadata(LLVMContext::MD_tbaa_struct);
+  Result.Scope = getMetadata(LLVMContext::MD_alias_scope);
+  Result.NoAlias = getMetadata(LLVMContext::MD_noalias);
+  return Result;
+}
+
 void Instruction::setAAMetadata(const AAMDNodes &N) {
   setMetadata(LLVMContext::MD_tbaa, N.TBAA);
   setMetadata(LLVMContext::MD_tbaa_struct, N.TBAAStruct);


        


More information about the llvm-commits mailing list