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

Artur Pilipenko via llvm-commits llvm-commits at lists.llvm.org
Mon Oct 26 16:27:00 PDT 2015


apilipenko created this revision.
apilipenko added reviewers: reames, sanjoy.
apilipenko added a subscriber: llvm-commits.

PruneEH incorrectly sets MadeChange while adding function attributes. To determine whether a change was made it compares function attributes set with new attributes set. Function attributes set might include new attributes set as well as some other attributes. In this case MadeChange is set, however no change is made. 

http://reviews.llvm.org/D14097

Files:
  lib/Transforms/IPO/PruneEH.cpp

Index: lib/Transforms/IPO/PruneEH.cpp
===================================================================
--- lib/Transforms/IPO/PruneEH.cpp
+++ lib/Transforms/IPO/PruneEH.cpp
@@ -165,9 +165,10 @@
       const AttributeSet &NPAL = AttributeSet::get(
           F->getContext(), AttributeSet::FunctionIndex, NewAttributes);
 
-      if (PAL != NPAL) {
+      F->addAttributes(AttributeSet::FunctionIndex, NPAL);
+
+      if (PAL != F->getAttributes().getFnAttributes()) {
         MadeChange = true;
-        F->addAttributes(AttributeSet::FunctionIndex, NPAL);
       }
     }
 


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


More information about the llvm-commits mailing list