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 | cf27afb64e3387a747a467072536df8259488213 (patch) | |
tree | 43331ff1be0281353c1f26bf0766aaaea7ca0b06 /lib/Transforms | |
parent | 7283e7c0569cd787ea21856d55aee84a5c8d4ab0 (diff) |
Do not call getTypeSize on a type that has no size
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@14584 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Transforms')
-rw-r--r-- | lib/Transforms/Scalar/InstructionCombining.cpp | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/lib/Transforms/Scalar/InstructionCombining.cpp b/lib/Transforms/Scalar/InstructionCombining.cpp index 28e2eec0b4..bf57119486 100644 --- a/lib/Transforms/Scalar/InstructionCombining.cpp +++ b/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; |