[PATCH] D14097: PruneEH pass incorrectly reports that a change was made

Artur Pilipenko via llvm-commits llvm-commits at lists.llvm.org
Fri Dec 11 08:38:44 PST 2015


This revision was automatically updated to reflect the committed changes.
Closed by commit rL255343: PruneEH pass incorrectly reports that a change was made (authored by apilipenko).

Changed prior to commit:
  http://reviews.llvm.org/D14097?vs=38951&id=42527#toc

Repository:
  rL LLVM

http://reviews.llvm.org/D14097

Files:
  llvm/trunk/lib/Transforms/IPO/PruneEH.cpp

Index: llvm/trunk/lib/Transforms/IPO/PruneEH.cpp
===================================================================
--- llvm/trunk/lib/Transforms/IPO/PruneEH.cpp
+++ llvm/trunk/lib/Transforms/IPO/PruneEH.cpp
@@ -153,21 +153,16 @@
   // If the SCC doesn't unwind or doesn't throw, note this fact.
   if (!SCCMightUnwind || !SCCMightReturn)
     for (CallGraphSCC::iterator I = SCC.begin(), E = SCC.end(); I != E; ++I) {
-      AttrBuilder NewAttributes;
-
-      if (!SCCMightUnwind)
-        NewAttributes.addAttribute(Attribute::NoUnwind);
-      if (!SCCMightReturn)
-        NewAttributes.addAttribute(Attribute::NoReturn);
-
       Function *F = (*I)->getFunction();
-      const AttributeSet &PAL = F->getAttributes().getFnAttributes();
-      const AttributeSet &NPAL = AttributeSet::get(
-          F->getContext(), AttributeSet::FunctionIndex, NewAttributes);
 
-      if (PAL != NPAL) {
+      if (!SCCMightUnwind && !F->hasFnAttribute(Attribute::NoUnwind)) {
+        F->addFnAttr(Attribute::NoUnwind);
+        MadeChange = true;
+      }
+
+      if (!SCCMightReturn && !F->hasFnAttribute(Attribute::NoReturn)) {
+        F->addFnAttr(Attribute::NoReturn);
         MadeChange = true;
-        F->addAttributes(AttributeSet::FunctionIndex, NPAL);
       }
     }
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D14097.42527.patch
Type: text/x-patch
Size: 1278 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20151211/d7b53399/attachment.bin>


More information about the llvm-commits mailing list