llvm::Function argument count is not a good indicator of how many arugments does the function have at source level. If we need more space, just resize vector conservatively. This vector is only used once per function.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@126957 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/CodeGen/AsmPrinter/DwarfDebug.cpp b/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
index 9aa0389..2feb125 100644
--- a/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
+++ b/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
@@ -2330,8 +2330,11 @@
   if (ArgNo == 0) 
     return false;
 
-  if (CurrentFnArguments.size() == 0)
+  size_t Size = CurrentFnArguments.size();
+  if (Size == 0)
     CurrentFnArguments.resize(MF->getFunction()->arg_size());
+  else if (ArgNo > Size)
+    CurrentFnArguments.resize(ArgNo * 2);
   CurrentFnArguments[ArgNo - 1] = Var;
   return true;
 }