[llvm-commits] [llvm] r81058 - /llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp

Devang Patel dpatel at apple.com
Fri Sep 4 17:34:15 PDT 2009


Author: dpatel
Date: Fri Sep  4 19:34:14 2009
New Revision: 81058

URL: http://llvm.org/viewvc/llvm-project?rev=81058&view=rev
Log:
Detect VLAs.
Do not use DenseMap operator[] because it inserts new entry if lookup fails. Use find() to check an entry in a DenseMap first.

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

Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp?rev=81058&r1=81057&r2=81058&view=diff

==============================================================================
--- llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp (original)
+++ llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp Fri Sep  4 19:34:14 2009
@@ -3981,7 +3981,11 @@
     // 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;
   }





More information about the llvm-commits mailing list