Push some more methods down to hide the use of the Attribute class.

Because the Attribute class is going to stop representing a collection of
attributes, limit the use of it as an aggregate in favor of using AttributeSet.
This replaces some of the uses for querying the function attributes.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@172844 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Transforms/IPO/ArgumentPromotion.cpp b/lib/Transforms/IPO/ArgumentPromotion.cpp
index 385544a..15a479e 100644
--- a/lib/Transforms/IPO/ArgumentPromotion.cpp
+++ b/lib/Transforms/IPO/ArgumentPromotion.cpp
@@ -592,7 +592,7 @@
 
   // Add any function attributes.
   attrs = PAL.getFnAttributes();
-  if (attrs.hasAttributes())
+  if (PAL.hasAttributes(AttributeSet::FunctionIndex))
     AttributesVec.push_back(AttributeWithIndex::get(AttributeSet::FunctionIndex,
                                                     attrs));
 
@@ -722,7 +722,7 @@
 
     // Add any function attributes.
     attrs = CallPAL.getFnAttributes();
-    if (attrs.hasAttributes())
+    if (CallPAL.hasAttributes(AttributeSet::FunctionIndex))
       AttributesVec.push_back(AttributeWithIndex::get(AttributeSet::FunctionIndex,
                                                       attrs));
 
diff --git a/lib/Transforms/IPO/DeadArgumentElimination.cpp b/lib/Transforms/IPO/DeadArgumentElimination.cpp
index 4757ce8..5b5a015 100644
--- a/lib/Transforms/IPO/DeadArgumentElimination.cpp
+++ b/lib/Transforms/IPO/DeadArgumentElimination.cpp
@@ -277,7 +277,7 @@
       for (unsigned i = 0; PAL.getSlot(i).Index <= NumArgs; ++i)
         AttributesVec.push_back(PAL.getSlot(i));
       Attribute FnAttrs = PAL.getFnAttributes();
-      if (FnAttrs.hasAttributes())
+      if (PAL.hasAttributes(AttributeSet::FunctionIndex))
         AttributesVec.push_back(AttributeWithIndex::get(AttributeSet::FunctionIndex,
                                                         FnAttrs));
       PAL = AttributeSet::get(Fn.getContext(), AttributesVec);
diff --git a/lib/Transforms/InstCombine/InstCombineCalls.cpp b/lib/Transforms/InstCombine/InstCombineCalls.cpp
index d17879b..63e452b 100644
--- a/lib/Transforms/InstCombine/InstCombineCalls.cpp
+++ b/lib/Transforms/InstCombine/InstCombineCalls.cpp
@@ -1176,7 +1176,7 @@
   }
 
   Attribute FnAttrs = CallerPAL.getFnAttributes();
-  if (FnAttrs.hasAttributes())
+  if (CallerPAL.hasAttributes(AttributeSet::FunctionIndex))
     attrVec.push_back(AttributeWithIndex::get(AttributeSet::FunctionIndex,
                                               FnAttrs));
 
@@ -1320,7 +1320,7 @@
 
       // Add any function attributes.
       Attr = Attrs.getFnAttributes();
-      if (Attr.hasAttributes())
+      if (Attrs.hasAttributes(AttributeSet::FunctionIndex))
         NewAttrs.push_back(AttributeWithIndex::get(AttributeSet::FunctionIndex,
                                                    Attr));
 
diff --git a/lib/Transforms/Utils/CloneFunction.cpp b/lib/Transforms/Utils/CloneFunction.cpp
index ccc3eae..ad753ab 100644
--- a/lib/Transforms/Utils/CloneFunction.cpp
+++ b/lib/Transforms/Utils/CloneFunction.cpp
@@ -103,10 +103,8 @@
                                     OldFunc->getAttributes()
                                      .getRetAttributes()));
     NewFunc->setAttributes(NewFunc->getAttributes()
-                           .addAttr(NewFunc->getContext(),
-                                    AttributeSet::FunctionIndex,
-                                    OldFunc->getAttributes()
-                                     .getFnAttributes()));
+                           .addFnAttributes(NewFunc->getContext(),
+                                            OldFunc->getAttributes()));
 
   }