From fd88f64934c43613dd4a70b97db620de1338782b Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Fri, 2 Sep 2005 18:41:28 +0000 Subject: [PATCH] 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 --- lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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); }