summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms/Scalar/InstructionCombining.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2004-07-02 22:55:47 +0000
committerChris Lattner <sabre@nondot.org>2004-07-02 22:55:47 +0000
commit49df6cefa5097bb535ae641629f331eca69b19d6 (patch)
tree73c59a82d8a304e1a5fc754ead7dc49f0687bfc9 /llvm/lib/Transforms/Scalar/InstructionCombining.cpp
parent317ef96a3ad6e0178afa1cd0870d9efaddd8563d (diff)
downloadbcm5719-llvm-49df6cefa5097bb535ae641629f331eca69b19d6.tar.gz
bcm5719-llvm-49df6cefa5097bb535ae641629f331eca69b19d6.zip
Do not call getTypeSize on a type that has no size
llvm-svn: 14584
Diffstat (limited to 'llvm/lib/Transforms/Scalar/InstructionCombining.cpp')
-rw-r--r--llvm/lib/Transforms/Scalar/InstructionCombining.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/llvm/lib/Transforms/Scalar/InstructionCombining.cpp b/llvm/lib/Transforms/Scalar/InstructionCombining.cpp
index 28e2eec0b41..bf571194864 100644
--- a/llvm/lib/Transforms/Scalar/InstructionCombining.cpp
+++ b/llvm/lib/Transforms/Scalar/InstructionCombining.cpp
@@ -2854,7 +2854,8 @@ Instruction *InstCombiner::visitAllocationInst(AllocationInst &AI) {
// If alloca'ing a zero byte object, replace the alloca with a null pointer.
// Note that we only do this for alloca's, because malloc should allocate and
// return a unique pointer, even for a zero byte allocation.
- if (isa<AllocaInst>(AI) && TD->getTypeSize(AI.getAllocatedType()) == 0)
+ if (isa<AllocaInst>(AI) && AI.getAllocatedType()->isSized() &&
+ TD->getTypeSize(AI.getAllocatedType()) == 0)
return ReplaceInstUsesWith(AI, Constant::getNullValue(AI.getType()));
return 0;
OpenPOWER on IntegriCloud