[PATCH] D14097: PruneEH pass incorrectly reports that a change was made
Artur Pilipenko via llvm-commits
llvm-commits at lists.llvm.org
Mon Nov 2 11:28:55 PST 2015
apilipenko updated this revision to Diff 38951.
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
@@ -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.38951.patch
Type: text/x-patch
Size: 1245 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20151102/a07ce38b/attachment.bin>
More information about the llvm-commits
mailing list