summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms
diff options
context:
space:
mode:
authorBill Wendling <isanbard@gmail.com>2013-01-21 22:44:49 +0000
committerBill Wendling <isanbard@gmail.com>2013-01-21 22:44:49 +0000
commitc90d9f89b7d85c6b4ae3692a78046e1496c8537e (patch)
tree4698bab5e4e80201bd516e46994bc43390d780d6 /llvm/lib/Transforms
parent60ccb9b2a926329de3d49716704c51cf7958b437 (diff)
downloadbcm5719-llvm-c90d9f89b7d85c6b4ae3692a78046e1496c8537e.tar.gz
bcm5719-llvm-c90d9f89b7d85c6b4ae3692a78046e1496c8537e.zip
Have AttributeSet::getRetAttributes() return an AttributeSet instead of Attribute.
This further restricts the use of the Attribute class to the Attribute family of classes. llvm-svn: 173098
Diffstat (limited to 'llvm/lib/Transforms')
-rw-r--r--llvm/lib/Transforms/IPO/ArgumentPromotion.cpp6
-rw-r--r--llvm/lib/Transforms/IPO/DeadArgumentElimination.cpp28
-rw-r--r--llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp8
3 files changed, 24 insertions, 18 deletions
diff --git a/llvm/lib/Transforms/IPO/ArgumentPromotion.cpp b/llvm/lib/Transforms/IPO/ArgumentPromotion.cpp
index c5b17dba515..39062e676c1 100644
--- a/llvm/lib/Transforms/IPO/ArgumentPromotion.cpp
+++ b/llvm/lib/Transforms/IPO/ArgumentPromotion.cpp
@@ -519,7 +519,8 @@ CallGraphNode *ArgPromotion::DoPromotion(Function *F,
// Add any return attributes.
if (PAL.hasAttributes(AttributeSet::ReturnIndex))
- AttributesVec.push_back(AttributeWithIndex::get(AttributeSet::ReturnIndex,
+ AttributesVec.push_back(AttributeWithIndex::get(F->getContext(),
+ AttributeSet::ReturnIndex,
PAL.getRetAttributes()));
// First, determine the new argument list
@@ -639,7 +640,8 @@ CallGraphNode *ArgPromotion::DoPromotion(Function *F,
// Add any return attributes.
if (CallPAL.hasAttributes(AttributeSet::ReturnIndex))
- AttributesVec.push_back(AttributeWithIndex::get(AttributeSet::ReturnIndex,
+ AttributesVec.push_back(AttributeWithIndex::get(F->getContext(),
+ AttributeSet::ReturnIndex,
CallPAL.getRetAttributes()));
// Loop over the operands, inserting GEP and loads in the caller as
diff --git a/llvm/lib/Transforms/IPO/DeadArgumentElimination.cpp b/llvm/lib/Transforms/IPO/DeadArgumentElimination.cpp
index f6486e12eb2..5204248c1fa 100644
--- a/llvm/lib/Transforms/IPO/DeadArgumentElimination.cpp
+++ b/llvm/lib/Transforms/IPO/DeadArgumentElimination.cpp
@@ -700,9 +700,6 @@ bool DAE::RemoveDeadStuffFromFunction(Function *F) {
SmallVector<AttributeWithIndex, 8> AttributesVec;
const AttributeSet &PAL = F->getAttributes();
- // The existing function return attributes.
- Attribute RAttrs = PAL.getRetAttributes();
-
// Find out the new return value.
Type *RetTy = FTy->getReturnType();
Type *NRetTy = NULL;
@@ -757,21 +754,26 @@ bool DAE::RemoveDeadStuffFromFunction(Function *F) {
assert(NRetTy && "No new return type found?");
+ // The existing function return attributes.
+ AttributeSet RAttrs = PAL.getRetAttributes();
+
// Remove any incompatible attributes, but only if we removed all return
// values. Otherwise, ensure that we don't have any conflicting attributes
// here. Currently, this should not be possible, but special handling might be
// required when new return value attributes are added.
if (NRetTy->isVoidTy())
RAttrs =
- Attribute::get(NRetTy->getContext(), AttrBuilder(RAttrs).
- removeAttributes(Attribute::typeIncompatible(NRetTy)));
+ AttributeSet::get(NRetTy->getContext(), AttributeSet::ReturnIndex,
+ AttrBuilder(RAttrs, AttributeSet::ReturnIndex).
+ removeAttributes(Attribute::typeIncompatible(NRetTy)));
else
- assert(!AttrBuilder(RAttrs).
+ assert(!AttrBuilder(RAttrs, AttributeSet::ReturnIndex).
hasAttributes(Attribute::typeIncompatible(NRetTy)) &&
"Return attributes no longer compatible?");
- if (RAttrs.hasAttributes())
- AttributesVec.push_back(AttributeWithIndex::get(AttributeSet::ReturnIndex,
+ if (RAttrs.hasAttributes(AttributeSet::ReturnIndex))
+ AttributesVec.push_back(AttributeWithIndex::get(NRetTy->getContext(),
+ AttributeSet::ReturnIndex,
RAttrs));
// Remember which arguments are still alive.
@@ -835,14 +837,16 @@ bool DAE::RemoveDeadStuffFromFunction(Function *F) {
const AttributeSet &CallPAL = CS.getAttributes();
// The call return attributes.
- Attribute RAttrs = CallPAL.getRetAttributes();
+ AttributeSet RAttrs = CallPAL.getRetAttributes();
// Adjust in case the function was changed to return void.
RAttrs =
- Attribute::get(NF->getContext(), AttrBuilder(RAttrs).
+ AttributeSet::get(NF->getContext(), AttributeSet::ReturnIndex,
+ AttrBuilder(RAttrs, AttributeSet::ReturnIndex).
removeAttributes(Attribute::typeIncompatible(NF->getReturnType())));
- if (RAttrs.hasAttributes())
- AttributesVec.push_back(AttributeWithIndex::get(AttributeSet::ReturnIndex,
+ if (RAttrs.hasAttributes(AttributeSet::ReturnIndex))
+ AttributesVec.push_back(AttributeWithIndex::get(NF->getContext(),
+ AttributeSet::ReturnIndex,
RAttrs));
// Declare these outside of the loops, so we can reuse them for the second
diff --git a/llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp b/llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp
index f3036d82dd5..6d4f1883b69 100644
--- a/llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp
+++ b/llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp
@@ -1287,10 +1287,10 @@ InstCombiner::transformCallThroughTrampoline(CallSite CS,
// mean appending it. Likewise for attributes.
// Add any result attributes.
- Attribute Attr = Attrs.getRetAttributes();
if (Attrs.hasAttributes(AttributeSet::ReturnIndex))
- NewAttrs.push_back(AttributeWithIndex::get(AttributeSet::ReturnIndex,
- Attr));
+ NewAttrs.push_back(AttributeWithIndex::get(Caller->getContext(),
+ AttributeSet::ReturnIndex,
+ Attrs.getRetAttributes()));
{
unsigned Idx = 1;
@@ -1310,7 +1310,7 @@ InstCombiner::transformCallThroughTrampoline(CallSite CS,
// Add the original argument and attributes.
NewArgs.push_back(*I);
- Attr = Attrs.getParamAttributes(Idx);
+ Attribute Attr = Attrs.getParamAttributes(Idx);
if (Attr.hasAttributes())
NewAttrs.push_back
(AttributeWithIndex::get(Idx + (Idx >= NestIdx), Attr));
OpenPOWER on IntegriCloud