mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-10-20 03:23:01 +02:00
PruneEH pass incorrectly reports that a change was made
Reviewed By: reames Differential Revision: http://reviews.llvm.org/D14097 llvm-svn: 255343
This commit is contained in:
parent
f5a3f4d77c
commit
8b6635b2f6
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user