Check bb to ensure that alloca is in separate basic block.
authorDevang Patel <dpatel@apple.com>
Wed, 15 Sep 2010 18:13:55 +0000 (18:13 +0000)
committerDevang Patel <dpatel@apple.com>
Wed, 15 Sep 2010 18:13:55 +0000 (18:13 +0000)
This fixes funcargs.exp regression reported by gdb testsuite.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@113992 91177308-0d34-0410-b5e6-96231b3b80d8

lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp

index db3ca11173816f9d142cfe165001cba8a73673a9..b29a5b5ffec4de8498f1d9bc9aa55b72fc98491b 100644 (file)
@@ -4122,13 +4122,15 @@ SelectionDAGBuilder::visitIntrinsicCall(const CallInst &I, unsigned Intrinsic) {
         // 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;
+          if (AI->getParent() != DI.getParent()) {
+            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.