projects
/
oota-llvm.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
PruneEH pass incorrectly reports that a change was made
[oota-llvm.git]
/
lib
/
Transforms
/
IPO
/
PruneEH.cpp
diff --git
a/lib/Transforms/IPO/PruneEH.cpp
b/lib/Transforms/IPO/PruneEH.cpp
index cd2411ba554c8bf873ac6a1bb3a5f2bbfb8f9d7c..3af4afb903fee6fcc5c3a6ba88b1c0d53b9c2305 100644
(file)
--- a/
lib/Transforms/IPO/PruneEH.cpp
+++ b/
lib/Transforms/IPO/PruneEH.cpp
@@
-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) {
// 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();
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;
MadeChange = true;
- F->addAttributes(AttributeSet::FunctionIndex, NPAL);
}
}
}
}