Reapply r128045 and r128051 with fixes.

This will extend the ranges of debug info variables in registers until they are
clobbered.

Fix 1: Don't mistake DBG_VALUE instructions referring to incoming arguments on
the stack with DBG_VALUE instructions referring to variables in the frame
pointer. This fixes the gdb test-suite failure.

Fix 2: Don't trace through copies to physical registers setting up call
arguments. These registers are call clobbered, and the source register is more
likely to be a callee-saved register that can be extended through the call
instruction.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@128114 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/CodeGen/AsmPrinter/DwarfDebug.h b/lib/CodeGen/AsmPrinter/DwarfDebug.h
index 2863ea3..e59ab5b 100644
--- a/lib/CodeGen/AsmPrinter/DwarfDebug.h
+++ b/lib/CodeGen/AsmPrinter/DwarfDebug.h
@@ -200,8 +200,6 @@
 
   typedef SmallVector<DbgScope *, 2> ScopeVector;
 
-  SmallPtrSet<const MachineInstr *, 8> InsnsEndScopeSet;
-
   /// InlineInfo - Keep track of inlined functions and their location.  This
   /// information is used to populate debug_inlined section.
   typedef std::pair<const MCSymbol *, DIE *> InlineInfoLabels;
@@ -224,6 +222,16 @@
   /// a debuggging information entity.
   SmallPtrSet<const MachineInstr *, 8> InsnNeedsLabel;
 
+  /// InsnsNeedsLabelAfter - Collection of instructions that need a label after
+  /// the instruction because they end a scope of clobber a register.
+  SmallPtrSet<const MachineInstr *, 8> InsnsNeedsLabelAfter;
+
+  /// RegClobberInsn - For each DBG_VALUE instruction referring to a register
+  /// that is clobbered before the variable gets a new DBG_VALUE, map the
+  /// instruction that clobbered the register. This instruction will also be in
+  /// InsnsNeedsLabelAfter.
+  DenseMap<const MachineInstr *, const MachineInstr *> RegClobberInsn;
+
   SmallVector<const MCSymbol *, 8> DebugRangeSymbols;
 
   /// Previous instruction's location information. This is used to determine