aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2005-09-02 18:41:28 +0000
committerChris Lattner <sabre@nondot.org>2005-09-02 18:41:28 +0000
commitfd88f64934c43613dd4a70b97db620de1338782b (patch)
tree5a068fe4ca7cb7e4f9efadc46f9a69203325bbb8
parent1e9de3ed2db440fac99e5cc85b7d98b0a23a2727 (diff)
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
-rw-r--r--lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp b/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp
index bb27ad09d4..ecf9797b48 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);
}