[llvm-commits] [llvm] r87023 - /llvm/trunk/lib/CodeGen/AsmPrinter/DwarfException.cpp

Bill Wendling isanbard at gmail.com
Thu Nov 12 12:51:54 PST 2009


Author: void
Date: Thu Nov 12 14:51:53 2009
New Revision: 87023

URL: http://llvm.org/viewvc/llvm-project?rev=87023&view=rev
Log:
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).

Modified:
    llvm/trunk/lib/CodeGen/AsmPrinter/DwarfException.cpp

Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfException.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfException.cpp?rev=87023&r1=87022&r2=87023&view=diff

==============================================================================
--- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfException.cpp (original)
+++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfException.cpp Thu Nov 12 14:51:53 2009
@@ -494,14 +494,25 @@
           // 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<Function>(MO.getGlobal())) {
+                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;
-                  break;
                 }
               }
             }





More information about the llvm-commits mailing list