mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-12-26 21:47:07 +00:00
Do not call getTypeSize on a type that has no size
llvm-svn: 14584
This commit is contained in:
parent
6a3e24fcdd
commit
1120899069
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user