Skip to content

Commit

Permalink
Return if we changed anything or not.
Browse files Browse the repository at this point in the history
llvm-svn: 99695
  • Loading branch information
isanbard committed Mar 27, 2010
1 parent f2c1f40 commit ec8b44a
Showing 1 changed file with 9 additions and 11 deletions.
20 changes: 9 additions & 11 deletions llvm/lib/CodeGen/DwarfEHPrepare.cpp
Expand Up @@ -86,7 +86,7 @@ namespace {
/// CleanupSelectors - Any remaining eh.selector intrinsic calls which still
/// use the ".llvm.eh.catch.all.value" call need to convert to using it's
/// initializer instead.
void CleanupSelectors();
bool CleanupSelectors();

/// HandleURoRInvokes - Handle invokes of "_Unwind_Resume_or_Rethrow"
/// calls. The "unwind" part of these invokes jump to a landing pad within
Expand Down Expand Up @@ -220,7 +220,8 @@ DwarfEHPrepare::FindSelectorAndURoR(Instruction *Inst, bool &URoRInvoke,
/// CleanupSelectors - Any remaining eh.selector intrinsic calls which still use
/// the ".llvm.eh.catch.all.value" call need to convert to using it's
/// initializer instead.
void DwarfEHPrepare::CleanupSelectors() {
bool DwarfEHPrepare::CleanupSelectors() {
bool Changed = false;
for (Value::use_iterator
I = SelectorIntrinsic->use_begin(),
E = SelectorIntrinsic->use_end(); I != E; ++I) {
Expand All @@ -232,7 +233,10 @@ void DwarfEHPrepare::CleanupSelectors() {
GlobalVariable *GV = dyn_cast<GlobalVariable>(Sel->getOperand(OpIdx));
if (GV != EHCatchAllValue) continue;
Sel->setOperand(OpIdx, EHCatchAllValue->getInitializer());
Changed = true;
}

return Changed;
}

/// HandleURoRInvokes - Handle invokes of "_Unwind_Resume_or_Rethrow" calls. The
Expand All @@ -254,19 +258,13 @@ bool DwarfEHPrepare::HandleURoRInvokes() {

if (!URoR) {
URoR = F->getParent()->getFunction("_Unwind_Resume_or_Rethrow");
if (!URoR) {
CleanupSelectors();
return false;
}
if (!URoR) return CleanupSelectors();
}

if (!ExceptionValueIntrinsic) {
ExceptionValueIntrinsic =
Intrinsic::getDeclaration(F->getParent(), Intrinsic::eh_exception);
if (!ExceptionValueIntrinsic) {
CleanupSelectors();
return false;
}
if (!ExceptionValueIntrinsic) return CleanupSelectors();
}

bool Changed = false;
Expand Down Expand Up @@ -337,7 +335,7 @@ bool DwarfEHPrepare::HandleURoRInvokes() {
}
}

CleanupSelectors();
Changed |= CleanupSelectors();
return Changed;
}

Expand Down

0 comments on commit ec8b44a

Please sign in to comment.