[llvm] r300787 - [GlobalOpt] Simplify attribute code stripping nest, NFC

Reid Kleckner via llvm-commits llvm-commits at lists.llvm.org
Wed Apr 19 16:26:44 PDT 2017


Author: rnk
Date: Wed Apr 19 18:26:44 2017
New Revision: 300787

URL: http://llvm.org/viewvc/llvm-project?rev=300787&view=rev
Log:
[GlobalOpt] Simplify attribute code stripping nest, NFC

Modified:
    llvm/trunk/lib/Transforms/IPO/GlobalOpt.cpp   (contents, props changed)

Modified: llvm/trunk/lib/Transforms/IPO/GlobalOpt.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/IPO/GlobalOpt.cpp?rev=300787&r1=300786&r2=300787&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/IPO/GlobalOpt.cpp (original)
+++ llvm/trunk/lib/Transforms/IPO/GlobalOpt.cpp Wed Apr 19 18:26:44 2017
@@ -1979,16 +1979,11 @@ static void ChangeCalleesToFastCall(Func
   }
 }
 
-static AttributeList StripNest(LLVMContext &C, const AttributeList &Attrs) {
-  for (unsigned i = 0, e = Attrs.getNumSlots(); i != e; ++i) {
-    unsigned Index = Attrs.getSlotIndex(i);
-    if (!Attrs.getSlotAttributes(i).hasAttribute(Index, Attribute::Nest))
-      continue;
-
-    // There can be only one.
-    return Attrs.removeAttribute(C, Index, Attribute::Nest);
-  }
-
+static AttributeList StripNest(LLVMContext &C, AttributeList Attrs) {
+  // There can be at most one attribute set with a nest attribute.
+  unsigned NestIndex;
+  if (Attrs.hasAttrSomewhere(Attribute::Nest, &NestIndex))
+    return Attrs.removeAttribute(C, NestIndex, Attribute::Nest);
   return Attrs;
 }
 

Propchange: llvm/trunk/lib/Transforms/IPO/GlobalOpt.cpp
------------------------------------------------------------------------------
--- svn:eol-style (original)
+++ svn:eol-style (removed)
@@ -1 +0,0 @@
-native




More information about the llvm-commits mailing list