Any debug info symbol is only valid if atleast one compile unit is seen.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@62294 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/CodeGen/AsmPrinter/DwarfWriter.cpp b/lib/CodeGen/AsmPrinter/DwarfWriter.cpp
index 4f115b1..5e98618 100644
--- a/lib/CodeGen/AsmPrinter/DwarfWriter.cpp
+++ b/lib/CodeGen/AsmPrinter/DwarfWriter.cpp
@@ -3083,6 +3083,10 @@
 
   /// ValidDebugInfo - Return true if V represents valid debug info value.
   bool ValidDebugInfo(Value *V) {
+
+    if (!shouldEmit)
+      return false;
+
     GlobalVariable *GV = getGlobalVariable(V);
     if (!GV)
       return false;