[NFC] Remove some unnecessary AttributeList methods
authorArthur Eubanks <aeubanks@google.com>
Wed, 18 Aug 2021 17:43:17 +0000 (10:43 -0700)
committerArthur Eubanks <aeubanks@google.com>
Wed, 18 Aug 2021 18:15:20 +0000 (11:15 -0700)
These rely on methods I'm trying to cleanup.

llvm/include/llvm/IR/Attributes.h
llvm/include/llvm/IR/Function.h
llvm/lib/CodeGen/MachineFunction.cpp
llvm/lib/IR/Attributes.cpp
llvm/lib/IR/Verifier.cpp

index 857e6c6..36dc563 100644 (file)
@@ -846,13 +846,6 @@ public:
     return getDereferenceableOrNullBytes(ArgNo + FirstArgIndex);
   }
 
-  /// Get the allocsize argument numbers (or pair(0, 0) if unknown).
-  std::pair<unsigned, Optional<unsigned>>
-  getAllocSizeArgs(unsigned Index) const;
-
-  /// Get the vscale_range argument numbers (or pair(0, 0) if unknown).
-  std::pair<unsigned, unsigned> getVScaleRangeArgs(unsigned Index) const;
-
   /// Return the attributes at the index as a string.
   std::string getAsString(unsigned Index, bool InAttrGrp = false) const;
 
index 73a3b13..c031886 100644 (file)
@@ -424,19 +424,7 @@ public:
   void removeParamUndefImplyingAttrs(unsigned ArgNo);
 
   /// Return the stack alignment for the function.
-  unsigned getFnStackAlignment() const {
-    if (!hasFnAttribute(Attribute::StackAlignment))
-      return 0;
-    if (const auto MA =
-            AttributeSets.getStackAlignment(AttributeList::FunctionIndex))
-      return MA->value();
-    return 0;
-  }
-
-  /// Return the stack alignment for the function.
   MaybeAlign getFnStackAlign() const {
-    if (!hasFnAttribute(Attribute::StackAlignment))
-      return None;
     return AttributeSets.getStackAlignment(AttributeList::FunctionIndex);
   }
 
index 0a454b6..88dc5a6 100644 (file)
@@ -129,8 +129,8 @@ void ilist_alloc_traits<MachineBasicBlock>::deleteNode(MachineBasicBlock *MBB) {
 
 static inline unsigned getFnStackAlignment(const TargetSubtargetInfo *STI,
                                            const Function &F) {
-  if (F.hasFnAttribute(Attribute::StackAlignment))
-    return F.getFnStackAlignment();
+  if (auto MA = F.getFnStackAlign())
+    return MA->value();
   return STI->getFrameLowering()->getStackAlign().value();
 }
 
index 9f665b4..0bb6dbe 100644 (file)
@@ -1467,16 +1467,6 @@ uint64_t AttributeList::getDereferenceableOrNullBytes(unsigned Index) const {
   return getAttributes(Index).getDereferenceableOrNullBytes();
 }
 
-std::pair<unsigned, Optional<unsigned>>
-AttributeList::getAllocSizeArgs(unsigned Index) const {
-  return getAttributes(Index).getAllocSizeArgs();
-}
-
-std::pair<unsigned, unsigned>
-AttributeList::getVScaleRangeArgs(unsigned Index) const {
-  return getAttributes(Index).getVScaleRangeArgs();
-}
-
 std::string AttributeList::getAsString(unsigned Index, bool InAttrGrp) const {
   return getAttributes(Index).getAsString(InAttrGrp);
 }
index 9392b46..cdf9dc5 100644 (file)
@@ -1983,7 +1983,7 @@ void Verifier::verifyFunctionAttrs(FunctionType *FT, AttributeList Attrs,
 
   if (Attrs.hasFnAttr(Attribute::AllocSize)) {
     std::pair<unsigned, Optional<unsigned>> Args =
-        Attrs.getAllocSizeArgs(AttributeList::FunctionIndex);
+        Attrs.getFnAttrs().getAllocSizeArgs();
 
     auto CheckParam = [&](StringRef Name, unsigned ParamNo) {
       if (ParamNo >= FT->getNumParams()) {
@@ -2010,7 +2010,7 @@ void Verifier::verifyFunctionAttrs(FunctionType *FT, AttributeList Attrs,
 
   if (Attrs.hasFnAttr(Attribute::VScaleRange)) {
     std::pair<unsigned, unsigned> Args =
-        Attrs.getVScaleRangeArgs(AttributeList::FunctionIndex);
+        Attrs.getFnAttrs().getVScaleRangeArgs();
 
     if (Args.first > Args.second && Args.second != 0)
       CheckFailed("'vscale_range' minimum cannot be greater than maximum", V);