From: Chris Lattner Date: Fri, 2 Sep 2005 18:41:28 +0000 (+0000) Subject: Don't create zero sized stack objects even for array allocas with a zero X-Git-Url: http://plrg.eecs.uci.edu/git/?a=commitdiff_plain;h=fd88f64934c43613dd4a70b97db620de1338782b;p=oota-llvm.git Don't create zero sized stack objects even for array allocas with a zero number of elements. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23219 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp b/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp index bb27ad09d43..ecf9797b484 100644 --- a/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp +++ b/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp @@ -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); }