diff options
author | Reid Kleckner <rnk@google.com> | 2017-04-19 23:26:44 +0000 |
---|---|---|
committer | Reid Kleckner <rnk@google.com> | 2017-04-19 23:26:44 +0000 |
commit | 0a5ed3d5dc853c2ca525520923c2ea56cbcb7092 (patch) | |
tree | 442c56dac0894002de040ce46c05347ccd226e19 /llvm/lib/Transforms | |
parent | ae44aee9844d20e3ffa5f6c565412de28c643a6b (diff) | |
download | bcm5719-llvm-0a5ed3d5dc853c2ca525520923c2ea56cbcb7092.tar.gz bcm5719-llvm-0a5ed3d5dc853c2ca525520923c2ea56cbcb7092.zip |
[GlobalOpt] Simplify attribute code stripping nest, NFC
llvm-svn: 300787
Diffstat (limited to 'llvm/lib/Transforms')
-rw-r--r-- | llvm/lib/Transforms/IPO/GlobalOpt.cpp | 15 |
1 files changed, 5 insertions, 10 deletions
diff --git a/llvm/lib/Transforms/IPO/GlobalOpt.cpp b/llvm/lib/Transforms/IPO/GlobalOpt.cpp index ade4f21ceb5..ae9d4ce11e0 100644 --- a/llvm/lib/Transforms/IPO/GlobalOpt.cpp +++ b/llvm/lib/Transforms/IPO/GlobalOpt.cpp @@ -1979,16 +1979,11 @@ static void ChangeCalleesToFastCall(Function *F) { } } -static AttributeList StripNest(LLVMContext &C, const AttributeList &Attrs) { - for (unsigned i = 0, e = Attrs.getNumSlots(); i != e; ++i) { - unsigned Index = Attrs.getSlotIndex(i); - if (!Attrs.getSlotAttributes(i).hasAttribute(Index, Attribute::Nest)) - continue; - - // There can be only one. - return Attrs.removeAttribute(C, Index, Attribute::Nest); - } - +static AttributeList StripNest(LLVMContext &C, AttributeList Attrs) { + // There can be at most one attribute set with a nest attribute. + unsigned NestIndex; + if (Attrs.hasAttrSomewhere(Attribute::Nest, &NestIndex)) + return Attrs.removeAttribute(C, NestIndex, Attribute::Nest); return Attrs; } |