aboutsummaryrefslogtreecommitdiff
path: root/lib/CodeGen/AsmPrinter/DwarfException.cpp
diff options
context:
space:
mode:
authorBill Wendling <isanbard@gmail.com>2009-11-11 23:17:02 +0000
committerBill Wendling <isanbard@gmail.com>2009-11-11 23:17:02 +0000
commit73b55510585573cd37fca85864c8d7d73e6b4093 (patch)
tree5c0bea767b1d3c059ba0bec8b1dfeabb64dc17df /lib/CodeGen/AsmPrinter/DwarfException.cpp
parent9089ba8e5e76ab507d5f45c3791babb5bbc26f67 (diff)
Don't mark a call as potentially throwing if the function it's calling has the
"nounwind" attribute. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@86897 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/AsmPrinter/DwarfException.cpp')
-rw-r--r--lib/CodeGen/AsmPrinter/DwarfException.cpp22
1 files changed, 21 insertions, 1 deletions
diff --git a/lib/CodeGen/AsmPrinter/DwarfException.cpp b/lib/CodeGen/AsmPrinter/DwarfException.cpp
index b07c95bb59..693dcc2466 100644
--- a/lib/CodeGen/AsmPrinter/DwarfException.cpp
+++ b/lib/CodeGen/AsmPrinter/DwarfException.cpp
@@ -490,7 +490,27 @@ ComputeCallSiteTable(SmallVectorImpl<CallSiteEntry> &CallSites,
for (MachineBasicBlock::const_iterator MI = I->begin(), E = I->end();
MI != E; ++MI) {
if (!MI->isLabel()) {
- SawPotentiallyThrowing |= MI->getDesc().isCall();
+ if (MI->getDesc().isCall()) {
+ // Don't mark a call as potentially throwing if the function it's
+ // calling is marked "nounwind".
+ bool DoesNotThrow = false;
+ for (unsigned OI = 0, OE = MI->getNumOperands(); OI != OE; ++OI) {
+ const MachineOperand &MO = MI->getOperand(OI);
+
+ if (MO.isGlobal()) {
+ if (Function *F = dyn_cast<Function>(MO.getGlobal())) {
+ if (F->doesNotThrow()) {
+ DoesNotThrow = true;
+ break;
+ }
+ }
+ }
+ }
+
+ if (!DoesNotThrow)
+ SawPotentiallyThrowing = true;
+ }
+
continue;
}