Don't create zero sized stack objects even for array allocas with a zero
authorChris Lattner <sabre@nondot.org>
Fri, 2 Sep 2005 18:41:28 +0000 (18:41 +0000)
committerChris Lattner <sabre@nondot.org>
Fri, 2 Sep 2005 18:41:28 +0000 (18:41 +0000)
number of elements.

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

lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp

index bb27ad09d438763f68651b2d41b62f2f7c269e0e..ecf9797b4846389cd50afec27bc6c3078b4d5fc6 100644 (file)
@@ -150,7 +150,8 @@ FunctionLoweringInfo::FunctionLoweringInfo(TargetLowering &tli,
         // TargetData.  It serves primarily to 8-byte align doubles for X86.
         if (Align < TySize && TySize <= 8) Align = TySize;
 
-        TySize *= CUI->getValue();   // Get total allocated size.
+        if (CUI->getValue())           // Don't produce zero sized stack objects
+          TySize *= CUI->getValue();   // Get total allocated size.
         StaticAllocaMap[AI] =
           MF.getFrameInfo()->CreateStackObject((unsigned)TySize, Align);
       }