diff options
author | Anton Korobeynikov <asl@math.spbu.ru> | 2007-05-23 11:08:31 +0000 |
---|---|---|
committer | Anton Korobeynikov <asl@math.spbu.ru> | 2007-05-23 11:08:31 +0000 |
commit | 070280e97f801ae809ddcc7930c153929f253997 (patch) | |
tree | 5d8172c109cd9c6a3548343984482f732cd437d1 /lib/CodeGen/MachineModuleInfo.cpp | |
parent | 501fee71e077aad705ab2ab86741aec15b779174 (diff) |
Mark all calls as "could throw", when exceptions are enabled. Emit necessary LP info too. This fixes PR1439
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@37311 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/MachineModuleInfo.cpp')
-rw-r--r-- | lib/CodeGen/MachineModuleInfo.cpp | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/lib/CodeGen/MachineModuleInfo.cpp b/lib/CodeGen/MachineModuleInfo.cpp index d4d132989e..564c070bc3 100644 --- a/lib/CodeGen/MachineModuleInfo.cpp +++ b/lib/CodeGen/MachineModuleInfo.cpp @@ -1723,7 +1723,9 @@ void MachineModuleInfo::TidyLandingPads() { LandingPadInfo &LandingPad = LandingPads[i]; LandingPad.LandingPadLabel = MappedLabel(LandingPad.LandingPadLabel); - if (!LandingPad.LandingPadLabel) { + // Special case: we *should* emit LPs with null LP MBB. This indicates + // "rethrow" case. + if (!LandingPad.LandingPadLabel && LandingPad.LandingPadBlock) { LandingPads.erase(LandingPads.begin() + i); continue; } @@ -1768,9 +1770,15 @@ Function *MachineModuleInfo::getPersonality() const { /// getPersonalityIndex - Return unique index for current personality /// function. NULL personality function should always get zero index. unsigned MachineModuleInfo::getPersonalityIndex() const { - const Function* Personality = (!LandingPads.empty() ? - LandingPads[0].Personality : NULL); - + const Function* Personality = NULL; + + // Scan landing pads. If there is at least one non-NULL personality - use it. + for (unsigned i = 0; i != LandingPads.size(); ++i) + if (LandingPads[i].Personality) { + Personality = LandingPads[i].Personality; + break; + } + for (unsigned i = 0; i < Personalities.size(); ++i) { if (Personalities[i] == Personality) return i; |