Eli pointed out that va_arg instruction result values don't
[oota-llvm.git] / lib / Analysis / DebugInfo.cpp
index 194811be903fe667b37b7fe48f78c425fa526263..46abf333398a5a7d3894d4cf04c78a7f295cea40 100644 (file)
@@ -1028,7 +1028,7 @@ DIVariable DIFactory::CreateVariable(unsigned Tag, DIDescriptor Context,
                                      StringRef Name,
                                      DIFile F,
                                      unsigned LineNo,
-                                     DIType Ty, bool OptimizedBuild) {
+                                     DIType Ty, bool AlwaysPreserve) {
   Value *Elts[] = {
     GetTagConstant(Tag),
     Context,
@@ -1038,7 +1038,10 @@ DIVariable DIFactory::CreateVariable(unsigned Tag, DIDescriptor Context,
     Ty,
   };
   MDNode *Node = MDNode::get(VMContext, &Elts[0], 6);
-  if (OptimizedBuild) {
+  if (AlwaysPreserve) {
+    // The optimizer may remove local variable. If there is an interest
+    // to preserve variable info in such situation then stash it in a
+    // named mdnode.
     NamedMDNode *NMD = M.getOrInsertNamedMetadata("llvm.dbg.lv");
     NMD->addOperand(Node);
   }
@@ -1107,18 +1110,6 @@ DILocation DIFactory::CreateLocation(unsigned LineNo, unsigned ColumnNo,
   return DILocation(MDNode::get(VMContext, &Elts[0], 4));
 }
 
-/// CreateLocation - Creates a debug info location.
-DILocation DIFactory::CreateLocation(unsigned LineNo, unsigned ColumnNo,
-                                     DIScope S, MDNode *OrigLoc) {
- Value *Elts[] = {
-    ConstantInt::get(Type::getInt32Ty(VMContext), LineNo),
-    ConstantInt::get(Type::getInt32Ty(VMContext), ColumnNo),
-    S,
-    OrigLoc
-  };
-  return DILocation(MDNode::get(VMContext, &Elts[0], 4));
-}
-
 //===----------------------------------------------------------------------===//
 // DIFactory: Routines for inserting code into a function
 //===----------------------------------------------------------------------===//