summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms/IPO/ArgumentPromotion.cpp
diff options
context:
space:
mode:
authorBill Wendling <isanbard@gmail.com>2013-01-23 06:14:59 +0000
committerBill Wendling <isanbard@gmail.com>2013-01-23 06:14:59 +0000
commit49bc76cbb3072c077f684e93904df8bb46803210 (patch)
treea3a33d3d9c71bc02a6b9c69506a9904e0eba2b71 /llvm/lib/Transforms/IPO/ArgumentPromotion.cpp
parentc77c8e95e3f3a3f9161da179abf4b59f5dc78e74 (diff)
downloadbcm5719-llvm-49bc76cbb3072c077f684e93904df8bb46803210.tar.gz
bcm5719-llvm-49bc76cbb3072c077f684e93904df8bb46803210.zip
Remove the last of uses that use the Attribute object as a collection of attributes.
Collections of attributes are handled via the AttributeSet class now. This finally frees us up to make significant changes to how attributes are structured. llvm-svn: 173228
Diffstat (limited to 'llvm/lib/Transforms/IPO/ArgumentPromotion.cpp')
-rw-r--r--llvm/lib/Transforms/IPO/ArgumentPromotion.cpp29
1 files changed, 19 insertions, 10 deletions
diff --git a/llvm/lib/Transforms/IPO/ArgumentPromotion.cpp b/llvm/lib/Transforms/IPO/ArgumentPromotion.cpp
index 39062e676c1..627012f9fc3 100644
--- a/llvm/lib/Transforms/IPO/ArgumentPromotion.cpp
+++ b/llvm/lib/Transforms/IPO/ArgumentPromotion.cpp
@@ -537,9 +537,13 @@ CallGraphNode *ArgPromotion::DoPromotion(Function *F,
} else if (!ArgsToPromote.count(I)) {
// Unchanged argument
Params.push_back(I->getType());
- Attribute attrs = PAL.getParamAttributes(ArgIndex);
- if (attrs.hasAttributes())
- AttributesVec.push_back(AttributeWithIndex::get(Params.size(), attrs));
+ AttributeSet attrs = PAL.getParamAttributes(ArgIndex);
+ if (attrs.hasAttributes(ArgIndex)) {
+ AttributesVec.
+ push_back(AttributeWithIndex::get(F->getContext(),
+ ArgIndex, attrs));
+ AttributesVec.back().Index = Params.size();
+ }
} else if (I->use_empty()) {
// Dead argument (which are always marked as promotable)
++NumArgumentsDead;
@@ -653,10 +657,12 @@ CallGraphNode *ArgPromotion::DoPromotion(Function *F,
if (!ArgsToPromote.count(I) && !ByValArgsToTransform.count(I)) {
Args.push_back(*AI); // Unmodified argument
- Attribute Attrs = CallPAL.getParamAttributes(ArgIndex);
- if (Attrs.hasAttributes())
- AttributesVec.push_back(AttributeWithIndex::get(Args.size(), Attrs));
-
+ if (CallPAL.hasAttributes(ArgIndex)) {
+ AttributesVec.
+ push_back(AttributeWithIndex::get(F->getContext(), ArgIndex,
+ CallPAL.getParamAttributes(ArgIndex)));
+ AttributesVec.back().Index = Args.size();
+ }
} else if (ByValArgsToTransform.count(I)) {
// Emit a GEP and load for each element of the struct.
Type *AgTy = cast<PointerType>(I->getType())->getElementType();
@@ -715,9 +721,12 @@ CallGraphNode *ArgPromotion::DoPromotion(Function *F,
// Push any varargs arguments on the list.
for (; AI != CS.arg_end(); ++AI, ++ArgIndex) {
Args.push_back(*AI);
- Attribute Attrs = CallPAL.getParamAttributes(ArgIndex);
- if (Attrs.hasAttributes())
- AttributesVec.push_back(AttributeWithIndex::get(Args.size(), Attrs));
+ if (CallPAL.hasAttributes(ArgIndex)) {
+ AttributesVec.
+ push_back(AttributeWithIndex::get(F->getContext(), ArgIndex,
+ CallPAL.getParamAttributes(ArgIndex)));
+ AttributesVec.back().Index = Args.size();
+ }
}
// Add any function attributes.
OpenPOWER on IntegriCloud