[llvm-commits] [llvm] r113967 - /llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp

Devang Patel dpatel at apple.com
Wed Sep 15 07:48:53 PDT 2010


Author: dpatel
Date: Wed Sep 15 09:48:53 2010
New Revision: 113967

URL: http://llvm.org/viewvc/llvm-project?rev=113967&view=rev
Log:
If dbg.declare from non-entry block is using alloca from entry block then use offset available in StaticAllocaMap to emit DBG_VALUE. Right now, this has no material impact because varible info also collected using offset table maintained in machine module info.

Modified:
    llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp

Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp?rev=113967&r1=113966&r2=113967&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp (original)
+++ llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp Wed Sep 15 09:48:53 2010
@@ -4117,9 +4117,21 @@
       DAG.AddDbgValue(SDV, N.getNode(), isParameter);
     } else {
       // If Address is an arugment then try to emits its dbg value using
-      // virtual register info from the FuncInfo.ValueMap. Otherwise add undef
-      // to help track missing debug info.
+      // virtual register info from the FuncInfo.ValueMap. 
       if (!EmitFuncArgumentDbgValue(Address, Variable, 0, N)) {
+        // If variable is pinned by a alloca in dominating bb then
+        // use StaticAllocaMap.
+        if (const AllocaInst *AI = dyn_cast<AllocaInst>(Address)) {
+          DenseMap<const AllocaInst*, int>::iterator SI =
+            FuncInfo.StaticAllocaMap.find(AI);
+          if (SI != FuncInfo.StaticAllocaMap.end()) {
+            SDV = DAG.getDbgValue(Variable, SI->second,
+                                  0, dl, SDNodeOrder);
+            DAG.AddDbgValue(SDV, 0, false);
+            return 0;
+          }
+        }
+        // Otherwise add undef to help track missing debug info.
         SDV = DAG.getDbgValue(Variable, UndefValue::get(Address->getType()),
                               0, dl, SDNodeOrder);
         DAG.AddDbgValue(SDV, 0, false);





More information about the llvm-commits mailing list