Detect VLAs.
authorDevang Patel <dpatel@apple.com>
Sat, 5 Sep 2009 00:34:14 +0000 (00:34 +0000)
committerDevang Patel <dpatel@apple.com>
Sat, 5 Sep 2009 00:34:14 +0000 (00:34 +0000)
Do not use DenseMap operator[] because it inserts new entry if lookup fails. Use find() to check an entry in a DenseMap first.

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

lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp

index 555ef9e1b0a405b0665fa22d95643bfdc8abebd2..cd05f7124d243eae6ca92d241256fe538acb291d 100644 (file)
@@ -3981,7 +3981,11 @@ SelectionDAGLowering::visitIntrinsicCall(CallInst &I, unsigned Intrinsic) {
     // Don't handle byval struct arguments or VLAs, for example.
     if (!AI)
       return 0;
-    int FI = FuncInfo.StaticAllocaMap[AI];
+    DenseMap<const AllocaInst*, int>::iterator SI =
+      FuncInfo.StaticAllocaMap.find(AI);
+    if (SI == FuncInfo.StaticAllocaMap.end()) 
+      return 0; // VLAs.
+    int FI = SI->second;
     DW->RecordVariable(cast<MDNode>(Variable), FI);
     return 0;
   }