Remove some introspection functions.
[oota-llvm.git] / lib / Transforms / IPO / DeadArgumentElimination.cpp
index 3a38ca4bb8c6a49e5d1b3043cd00a047616bb3b8..61b37d87cca893a4c9d22a6f05837da9620d7e3a 100644 (file)
@@ -272,14 +272,16 @@ bool DAE::DeleteDeadVarargs(Function &Fn) {
 
     // Drop any attributes that were on the vararg arguments.
     AttributeSet PAL = CS.getAttributes();
-    if (!PAL.isEmpty() && PAL.getSlot(PAL.getNumSlots() - 1).Index > NumArgs) {
-      SmallVector<AttributeWithIndex, 8> AttributesVec;
-      for (unsigned i = 0; PAL.getSlot(i).Index <= NumArgs; ++i)
-        AttributesVec.push_back(PAL.getSlot(i));
+    if (!PAL.isEmpty() && PAL.getSlotIndex(PAL.getNumSlots() - 1) > NumArgs) {
+      SmallVector<AttributeSet, 8> AttributesVec;
+      for (unsigned i = 0; PAL.getSlotIndex(i) <= NumArgs; ++i)
+        AttributesVec.push_back(PAL.getSlotAttributes(i));
       if (PAL.hasAttributes(AttributeSet::FunctionIndex))
-        AttributesVec.push_back(AttributeWithIndex::get(Fn.getContext(),
-                                                        AttributeSet::FunctionIndex,
-                                                        PAL.getFnAttributes()));
+        AttributesVec.push_back(
+          AttributeSet::get(Fn.getContext(),
+                            AttributeWithIndex::get(Fn.getContext(),
+                                                    AttributeSet::FunctionIndex,
+                                                    PAL.getFnAttributes())));
       PAL = AttributeSet::get(Fn.getContext(), AttributesVec);
     }
 
@@ -765,10 +767,10 @@ bool DAE::RemoveDeadStuffFromFunction(Function *F) {
     RAttrs =
       AttributeSet::get(NRetTy->getContext(), AttributeSet::ReturnIndex,
                         AttrBuilder(RAttrs, AttributeSet::ReturnIndex).
-                         removeAttributes(Attribute::typeIncompatible(NRetTy)));
+                    removeAttributes(AttributeFuncs::typeIncompatible(NRetTy)));
   else
     assert(!AttrBuilder(RAttrs, AttributeSet::ReturnIndex).
-             hasAttributes(Attribute::typeIncompatible(NRetTy)) &&
+             hasAttributes(AttributeFuncs::typeIncompatible(NRetTy)) &&
            "Return attributes no longer compatible?");
 
   if (RAttrs.hasAttributes(AttributeSet::ReturnIndex))
@@ -846,7 +848,7 @@ bool DAE::RemoveDeadStuffFromFunction(Function *F) {
     RAttrs =
       AttributeSet::get(NF->getContext(), AttributeSet::ReturnIndex,
                         AttrBuilder(RAttrs, AttributeSet::ReturnIndex).
-           removeAttributes(Attribute::typeIncompatible(NF->getReturnType())));
+      removeAttributes(AttributeFuncs::typeIncompatible(NF->getReturnType())));
     if (RAttrs.hasAttributes(AttributeSet::ReturnIndex))
       AttributesVec.push_back(AttributeWithIndex::get(NF->getContext(),
                                                       AttributeSet::ReturnIndex,