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

Bill Wendling isanbard at gmail.com
Wed Nov 11 15:17:02 PST 2009


Author: void
Date: Wed Nov 11 17:17:02 2009
New Revision: 86897

URL: http://llvm.org/viewvc/llvm-project?rev=86897&view=rev
Log:
Don't mark a call as potentially throwing if the function it's calling has the
"nounwind" attribute.

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=86897&r1=86896&r2=86897&view=diff

==============================================================================
--- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfException.cpp (original)
+++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfException.cpp Wed Nov 11 17:17:02 2009
@@ -490,7 +490,27 @@
     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;
       }
 





More information about the llvm-commits mailing list