PruneEH: Only merge attribute sets when used. No functionality change.
authorBenjamin Kramer <benny.kra@googlemail.com>
Sat, 15 Jun 2013 10:55:39 +0000 (10:55 +0000)
committerBenjamin Kramer <benny.kra@googlemail.com>
Sat, 15 Jun 2013 10:55:39 +0000 (10:55 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@184041 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Transforms/IPO/PruneEH.cpp

index 73d9323195bbe4422484c21ae4f3ae75e23f7618..89529dee11082685f2a4694c41b94fc5422e0ec9 100644 (file)
@@ -145,15 +145,13 @@ bool PruneEH::runOnSCC(CallGraphSCC &SCC) {
         NewAttributes.addAttribute(Attribute::NoReturn);
 
       Function *F = (*I)->getFunction();
-      const AttributeSet &PAL = F->getAttributes();
-      const AttributeSet &NPAL =
-        PAL.addAttributes(F->getContext(), AttributeSet::FunctionIndex,
-                          AttributeSet::get(F->getContext(),
-                                            AttributeSet::FunctionIndex,
-                                            NewAttributes));
+      const AttributeSet &PAL = F->getAttributes().getFnAttributes();
+      const AttributeSet &NPAL = AttributeSet::get(
+          F->getContext(), AttributeSet::FunctionIndex, NewAttributes);
+
       if (PAL != NPAL) {
         MadeChange = true;
-        F->setAttributes(NPAL);
+        F->addAttributes(AttributeSet::FunctionIndex, NPAL);
       }
     }