From 2a3c1cca7d2b21f7c1115b1aa3fea146ed229335 Mon Sep 17 00:00:00 2001 From: Bill Wendling Date: Sun, 14 Oct 2012 07:52:48 +0000 Subject: [PATCH] Remove the bitwise AND operators from the Attributes class. Replace it with the equivalent from the builder class. llvm-svn: 165896 --- llvm/include/llvm/Attributes.h | 3 --- llvm/lib/Transforms/IPO/DeadArgumentElimination.cpp | 5 +++-- llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp | 3 ++- llvm/lib/VMCore/Attributes.cpp | 8 -------- llvm/lib/VMCore/Verifier.cpp | 7 ++++--- 5 files changed, 9 insertions(+), 17 deletions(-) diff --git a/llvm/include/llvm/Attributes.h b/llvm/include/llvm/Attributes.h index 08cfb86..24d52bc 100644 --- a/llvm/include/llvm/Attributes.h +++ b/llvm/include/llvm/Attributes.h @@ -235,9 +235,6 @@ public: return Attrs.Bits != A.Attrs.Bits; } - Attributes operator & (const Attributes &A) const; - Attributes &operator &= (const Attributes &A); - uint64_t Raw() const; /// @brief Which attributes cannot be applied to a type. diff --git a/llvm/lib/Transforms/IPO/DeadArgumentElimination.cpp b/llvm/lib/Transforms/IPO/DeadArgumentElimination.cpp index 6b52387..aa34b33 100644 --- a/llvm/lib/Transforms/IPO/DeadArgumentElimination.cpp +++ b/llvm/lib/Transforms/IPO/DeadArgumentElimination.cpp @@ -766,8 +766,9 @@ bool DAE::RemoveDeadStuffFromFunction(Function *F) { Attributes::get(Attributes::Builder(RAttrs). removeAttributes(Attributes::typeIncompatible(NRetTy))); else - assert((RAttrs & Attributes::typeIncompatible(NRetTy)) == 0 - && "Return attributes no longer compatible?"); + assert(!Attributes::Builder(RAttrs). + hasAttributes(Attributes::typeIncompatible(NRetTy)) && + "Return attributes no longer compatible?"); if (RAttrs) AttributesVec.push_back(AttributeWithIndex::get(0, RAttrs)); diff --git a/llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp b/llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp index 34e16c7..aa4b6b4 100644 --- a/llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp +++ b/llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp @@ -1038,7 +1038,8 @@ bool InstCombiner::transformConstExprCastCall(CallSite CS) { return false; // Cannot transform this parameter value. Attributes Attrs = CallerPAL.getParamAttributes(i + 1); - if (Attrs & Attributes::typeIncompatible(ParamTy)) + if (Attributes::Builder(Attrs). + hasAttributes(Attributes::typeIncompatible(ParamTy))) return false; // Attribute not compatible with transformed value. // If the parameter is passed as a byval argument, then we have to have a diff --git a/llvm/lib/VMCore/Attributes.cpp b/llvm/lib/VMCore/Attributes.cpp index 635ad14..fadb8ca 100644 --- a/llvm/lib/VMCore/Attributes.cpp +++ b/llvm/lib/VMCore/Attributes.cpp @@ -93,14 +93,6 @@ bool Attributes::isEmptyOrSingleton() const { return Attrs.isEmptyOrSingleton(); } -Attributes Attributes::operator & (const Attributes &A) const { - return Attributes(Raw() & A.Raw()); -} -Attributes &Attributes::operator &= (const Attributes &A) { - Attrs.Bits &= A.Raw(); - return *this; -} - uint64_t Attributes::Raw() const { return Attrs.Bits; } diff --git a/llvm/lib/VMCore/Verifier.cpp b/llvm/lib/VMCore/Verifier.cpp index 53744b4..5d431df 100644 --- a/llvm/lib/VMCore/Verifier.cpp +++ b/llvm/lib/VMCore/Verifier.cpp @@ -567,9 +567,10 @@ void Verifier::VerifyParameterAttrs(Attributes Attrs, Type *Ty, Attrs.hasAttribute(Attributes::AlwaysInline)), "Attributes " "'noinline and alwaysinline' are incompatible!", V); - Attributes TypeI = Attrs & Attributes::typeIncompatible(Ty); - Assert1(!TypeI, "Wrong type for attribute " + - TypeI.getAsString(), V); + Assert1(!Attributes::Builder(Attrs). + hasAttributes(Attributes::typeIncompatible(Ty)), + "Wrong types for attribute: " + + Attributes::typeIncompatible(Ty).getAsString(), V); if (PointerType *PTy = dyn_cast(Ty)) Assert1(!Attrs.hasAttribute(Attributes::ByVal) || -- 2.7.4