diff options
author | Reid Kleckner <rnk@google.com> | 2017-04-10 20:18:10 +0000 |
---|---|---|
committer | Reid Kleckner <rnk@google.com> | 2017-04-10 20:18:10 +0000 |
commit | 324c99dee5096be095adc3972c4a512ca0f74090 (patch) | |
tree | 9719e54e4dcaa0633d5b1aa58dec3b98d5bebebd /llvm/lib/Transforms/IPO/MergeFunctions.cpp | |
parent | 5be1176543aa4d1fca8dbac59c7908473b3447fc (diff) | |
download | bcm5719-llvm-324c99dee5096be095adc3972c4a512ca0f74090.tar.gz bcm5719-llvm-324c99dee5096be095adc3972c4a512ca0f74090.zip |
[IR] Make AttributeSetNode public, avoid temporary AttributeList copies
Summary:
AttributeList::get(Fn|Ret|Param)Attributes no longer creates a temporary
AttributeList just to hide the AttributeSetNode type.
I've also added a factory method to create AttributeLists from a
parallel array of AttributeSetNodes. I think this simplifies
construction of AttributeLists when rewriting function prototypes.
Previously we would test if a particular index had attributes, and
conditionally add a temporary attribute list to a vector. Now the
attribute set vector is parallel to the argument vector already that
these passes already construct.
My long term vision is to wrap AttributeSetNode* inside an AttributeSet
type that holds the enum attributes, but that will come in a follow up
change.
I haven't done any performance measurements for this change because
profiling hasn't shown that any of the affected code is hot.
Reviewers: pete, chandlerc, sanjoy, hfinkel
Reviewed By: pete
Subscribers: jfb, llvm-commits
Differential Revision: https://reviews.llvm.org/D31198
llvm-svn: 299875
Diffstat (limited to 'llvm/lib/Transforms/IPO/MergeFunctions.cpp')
-rw-r--r-- | llvm/lib/Transforms/IPO/MergeFunctions.cpp | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/llvm/lib/Transforms/IPO/MergeFunctions.cpp b/llvm/lib/Transforms/IPO/MergeFunctions.cpp index dc7390232c5..5d41ca9f9fc 100644 --- a/llvm/lib/Transforms/IPO/MergeFunctions.cpp +++ b/llvm/lib/Transforms/IPO/MergeFunctions.cpp @@ -439,8 +439,7 @@ void MergeFunctions::replaceDirectCallers(Function *Old, Function *New) { Context, AttributeList::ReturnIndex, NewFuncAttrs.getRetAttributes()); for (unsigned argIdx = 0; argIdx < CS.arg_size(); argIdx++) { - AttributeList Attrs = NewFuncAttrs.getParamAttributes(argIdx); - if (Attrs.getNumSlots()) + if (AttributeSetNode *Attrs = NewFuncAttrs.getParamAttributes(argIdx)) CallSiteAttrs = CallSiteAttrs.addAttributes(Context, argIdx, Attrs); } |