From ac18929801f1789d3f735733011541b19a205196 Mon Sep 17 00:00:00 2001 From: Bill Wendling Date: Thu, 12 Nov 2009 20:51:53 +0000 Subject: [PATCH] If there's more than one function operand to a call instruction, be conservative and don't assume that the call doesn't throw. It would be nice if there were a way to determine which is the callee and which is a parameter. In practice, the architecture we care about normally only have one operand for a call instruction (x86 and arm). git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@87023 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/CodeGen/AsmPrinter/DwarfException.cpp | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/lib/CodeGen/AsmPrinter/DwarfException.cpp b/lib/CodeGen/AsmPrinter/DwarfException.cpp index 693dcc2466d..1ef34b96e0e 100644 --- a/lib/CodeGen/AsmPrinter/DwarfException.cpp +++ b/lib/CodeGen/AsmPrinter/DwarfException.cpp @@ -494,15 +494,26 @@ ComputeCallSiteTable(SmallVectorImpl &CallSites, // Don't mark a call as potentially throwing if the function it's // calling is marked "nounwind". bool DoesNotThrow = false; + bool SawFunc = 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(MO.getGlobal())) { - if (F->doesNotThrow()) { - DoesNotThrow = true; + if (SawFunc) { + // Be conservative. If we have more than one function operand + // for this call, then we can't make the assumption that it's + // the callee and not a parameter to the call. + // + // FIXME: Determine if there's a way to say that `F' is the + // callee or parameter. + DoesNotThrow = false; break; } + if (F->doesNotThrow()) { + SawFunc = true; + DoesNotThrow = true; + } } } }