[llvm] r255343 - PruneEH pass incorrectly reports that a change was made
Artur Pilipenko via llvm-commits
llvm-commits at lists.llvm.org
Fri Dec 11 08:30:26 PST 2015
Author: apilipenko
Date: Fri Dec 11 10:30:26 2015
New Revision: 255343
URL: http://llvm.org/viewvc/llvm-project?rev=255343&view=rev
Log:
PruneEH pass incorrectly reports that a change was made
Reviewed By: reames
Differential Revision: http://reviews.llvm.org/D14097
Modified:
llvm/trunk/lib/Transforms/IPO/PruneEH.cpp
Modified: llvm/trunk/lib/Transforms/IPO/PruneEH.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/IPO/PruneEH.cpp?rev=255343&r1=255342&r2=255343&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/IPO/PruneEH.cpp (original)
+++ llvm/trunk/lib/Transforms/IPO/PruneEH.cpp Fri Dec 11 10:30:26 2015
@@ -153,21 +153,16 @@ bool PruneEH::runOnSCC(CallGraphSCC &SCC
// 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);
}
}
More information about the llvm-commits
mailing list