summaryrefslogtreecommitdiff
path: root/lib/Transforms
diff options
context:
space:
mode:
authorBill Wendling <isanbard@gmail.com>2012-10-16 05:23:31 +0000
committerBill Wendling <isanbard@gmail.com>2012-10-16 05:23:31 +0000
commit46d5dd9b058f31637f2449b2925f13a5707d126d (patch)
tree89dd5bb9b5733ce3f606c74c45a9fa35ace97bee /lib/Transforms
parent76b67df11e5cdb87e954a0ad7d1cd7fd4a502be1 (diff)
downloadllvm-46d5dd9b058f31637f2449b2925f13a5707d126d.tar.gz
llvm-46d5dd9b058f31637f2449b2925f13a5707d126d.tar.bz2
llvm-46d5dd9b058f31637f2449b2925f13a5707d126d.tar.xz
Use the Attributes::get method which takes an AttrVal value directly to simplify the code a bit. No functionality change.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@166009 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Transforms')
-rw-r--r--lib/Transforms/IPO/GlobalOpt.cpp6
-rw-r--r--lib/Transforms/Scalar/ObjCARC.cpp36
-rw-r--r--lib/Transforms/Scalar/SimplifyLibCalls.cpp5
3 files changed, 13 insertions, 34 deletions
diff --git a/lib/Transforms/IPO/GlobalOpt.cpp b/lib/Transforms/IPO/GlobalOpt.cpp
index 6468ff3276..678189b3d6 100644
--- a/lib/Transforms/IPO/GlobalOpt.cpp
+++ b/lib/Transforms/IPO/GlobalOpt.cpp
@@ -2062,15 +2062,13 @@ static void ChangeCalleesToFastCall(Function *F) {
}
static AttrListPtr StripNest(LLVMContext &C, const AttrListPtr &Attrs) {
- AttrBuilder B;
- B.addAttribute(Attributes::Nest);
-
for (unsigned i = 0, e = Attrs.getNumSlots(); i != e; ++i) {
if (!Attrs.getSlot(i).Attrs.hasAttribute(Attributes::Nest))
continue;
// There can be only one.
- return Attrs.removeAttr(C, Attrs.getSlot(i).Index, Attributes::get(C, B));
+ return Attrs.removeAttr(C, Attrs.getSlot(i).Index,
+ Attributes::get(C, Attributes::Nest));
}
return Attrs;
diff --git a/lib/Transforms/Scalar/ObjCARC.cpp b/lib/Transforms/Scalar/ObjCARC.cpp
index e18208d4a5..dfdf50549d 100644
--- a/lib/Transforms/Scalar/ObjCARC.cpp
+++ b/lib/Transforms/Scalar/ObjCARC.cpp
@@ -1788,11 +1788,9 @@ Constant *ObjCARCOpt::getRetainRVCallee(Module *M) {
Type *I8X = PointerType::getUnqual(Type::getInt8Ty(C));
Type *Params[] = { I8X };
FunctionType *FTy = FunctionType::get(I8X, Params, /*isVarArg=*/false);
- AttrBuilder B;
- B.addAttribute(Attributes::NoUnwind);
AttrListPtr Attributes =
AttrListPtr().addAttr(M->getContext(), AttrListPtr::FunctionIndex,
- Attributes::get(M->getContext(), B));
+ Attributes::get(C, Attributes::NoUnwind));
RetainRVCallee =
M->getOrInsertFunction("objc_retainAutoreleasedReturnValue", FTy,
Attributes);
@@ -1806,11 +1804,9 @@ Constant *ObjCARCOpt::getAutoreleaseRVCallee(Module *M) {
Type *I8X = PointerType::getUnqual(Type::getInt8Ty(C));
Type *Params[] = { I8X };
FunctionType *FTy = FunctionType::get(I8X, Params, /*isVarArg=*/false);
- AttrBuilder B;
- B.addAttribute(Attributes::NoUnwind);
AttrListPtr Attributes =
AttrListPtr().addAttr(M->getContext(), AttrListPtr::FunctionIndex,
- Attributes::get(C, B));
+ Attributes::get(C, Attributes::NoUnwind));
AutoreleaseRVCallee =
M->getOrInsertFunction("objc_autoreleaseReturnValue", FTy,
Attributes);
@@ -1822,11 +1818,9 @@ Constant *ObjCARCOpt::getReleaseCallee(Module *M) {
if (!ReleaseCallee) {
LLVMContext &C = M->getContext();
Type *Params[] = { PointerType::getUnqual(Type::getInt8Ty(C)) };
- AttrBuilder B;
- B.addAttribute(Attributes::NoUnwind);
AttrListPtr Attributes =
AttrListPtr().addAttr(M->getContext(), AttrListPtr::FunctionIndex,
- Attributes::get(C, B));
+ Attributes::get(C, Attributes::NoUnwind));
ReleaseCallee =
M->getOrInsertFunction(
"objc_release",
@@ -1840,11 +1834,9 @@ Constant *ObjCARCOpt::getRetainCallee(Module *M) {
if (!RetainCallee) {
LLVMContext &C = M->getContext();
Type *Params[] = { PointerType::getUnqual(Type::getInt8Ty(C)) };
- AttrBuilder B;
- B.addAttribute(Attributes::NoUnwind);
AttrListPtr Attributes =
AttrListPtr().addAttr(M->getContext(), AttrListPtr::FunctionIndex,
- Attributes::get(C, B));
+ Attributes::get(C, Attributes::NoUnwind));
RetainCallee =
M->getOrInsertFunction(
"objc_retain",
@@ -1873,11 +1865,9 @@ Constant *ObjCARCOpt::getAutoreleaseCallee(Module *M) {
if (!AutoreleaseCallee) {
LLVMContext &C = M->getContext();
Type *Params[] = { PointerType::getUnqual(Type::getInt8Ty(C)) };
- AttrBuilder B;
- B.addAttribute(Attributes::NoUnwind);
AttrListPtr Attributes =
AttrListPtr().addAttr(M->getContext(), AttrListPtr::FunctionIndex,
- Attributes::get(C, B));
+ Attributes::get(C, Attributes::NoUnwind));
AutoreleaseCallee =
M->getOrInsertFunction(
"objc_autorelease",
@@ -3850,14 +3840,10 @@ Constant *ObjCARCContract::getStoreStrongCallee(Module *M) {
Type *I8XX = PointerType::getUnqual(I8X);
Type *Params[] = { I8XX, I8X };
- AttrBuilder BNoUnwind;
- BNoUnwind.addAttribute(Attributes::NoUnwind);
- AttrBuilder BNoCapture;
- BNoCapture.addAttribute(Attributes::NoCapture);
AttrListPtr Attributes = AttrListPtr()
.addAttr(M->getContext(), AttrListPtr::FunctionIndex,
- Attributes::get(C, BNoUnwind))
- .addAttr(M->getContext(), 1, Attributes::get(C, BNoCapture));
+ Attributes::get(C, Attributes::NoUnwind))
+ .addAttr(M->getContext(), 1, Attributes::get(C, Attributes::NoCapture));
StoreStrongCallee =
M->getOrInsertFunction(
@@ -3874,11 +3860,9 @@ Constant *ObjCARCContract::getRetainAutoreleaseCallee(Module *M) {
Type *I8X = PointerType::getUnqual(Type::getInt8Ty(C));
Type *Params[] = { I8X };
FunctionType *FTy = FunctionType::get(I8X, Params, /*isVarArg=*/false);
- AttrBuilder B;
- B.addAttribute(Attributes::NoUnwind);
AttrListPtr Attributes =
AttrListPtr().addAttr(M->getContext(), AttrListPtr::FunctionIndex,
- Attributes::get(C, B));
+ Attributes::get(C, Attributes::NoUnwind));
RetainAutoreleaseCallee =
M->getOrInsertFunction("objc_retainAutorelease", FTy, Attributes);
}
@@ -3891,11 +3875,9 @@ Constant *ObjCARCContract::getRetainAutoreleaseRVCallee(Module *M) {
Type *I8X = PointerType::getUnqual(Type::getInt8Ty(C));
Type *Params[] = { I8X };
FunctionType *FTy = FunctionType::get(I8X, Params, /*isVarArg=*/false);
- AttrBuilder B;
- B.addAttribute(Attributes::NoUnwind);
AttrListPtr Attributes =
AttrListPtr().addAttr(M->getContext(), AttrListPtr::FunctionIndex,
- Attributes::get(C, B));
+ Attributes::get(C, Attributes::NoUnwind));
RetainAutoreleaseRVCallee =
M->getOrInsertFunction("objc_retainAutoreleaseReturnValue", FTy,
Attributes);
diff --git a/lib/Transforms/Scalar/SimplifyLibCalls.cpp b/lib/Transforms/Scalar/SimplifyLibCalls.cpp
index 0223d39ab3..d86c4cbc9f 100644
--- a/lib/Transforms/Scalar/SimplifyLibCalls.cpp
+++ b/lib/Transforms/Scalar/SimplifyLibCalls.cpp
@@ -348,9 +348,8 @@ struct StrToOpt : public LibCallOptimization {
if (isa<ConstantPointerNull>(EndPtr)) {
// With a null EndPtr, this function won't capture the main argument.
// It would be readonly too, except that it still may write to errno.
- AttrBuilder B;
- B.addAttribute(Attributes::NoCapture);
- CI->addAttribute(1, Attributes::get(Callee->getContext(), B));
+ CI->addAttribute(1, Attributes::get(Callee->getContext(),
+ Attributes::NoCapture));
}
return 0;