diff options
author | Chris Lattner <sabre@nondot.org> | 2004-07-02 22:55:47 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2004-07-02 22:55:47 +0000 |
commit | 49df6cefa5097bb535ae641629f331eca69b19d6 (patch) | |
tree | 73c59a82d8a304e1a5fc754ead7dc49f0687bfc9 /llvm/lib/Transforms/Scalar/InstructionCombining.cpp | |
parent | 317ef96a3ad6e0178afa1cd0870d9efaddd8563d (diff) | |
download | bcm5719-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.cpp | 3 |
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; |