Factor some code to needsCFIMoves. Avoid printing moves when we don't have to.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@130501 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/CodeGen/AsmPrinter/DwarfCFIException.cpp b/lib/CodeGen/AsmPrinter/DwarfCFIException.cpp
index 1dcfddf..e85d529 100644
--- a/lib/CodeGen/AsmPrinter/DwarfCFIException.cpp
+++ b/lib/CodeGen/AsmPrinter/DwarfCFIException.cpp
@@ -78,8 +78,7 @@
   shouldEmitTable = !MMI->getLandingPads().empty();
 
   // See if we need frame move info.
-  shouldEmitMoves = MMI->hasDebugInfo() ||
-    !Asm->MF->getFunction()->doesNotThrow() || UnwindTablesMandatory;
+  shouldEmitMoves = Asm->needsCFIMoves();
 
   if (shouldEmitMoves || shouldEmitTable)
     // Assumes in correct section after the entry point.