mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-01-27 14:34:58 +00:00
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
This commit is contained in:
parent
7283e7c056
commit
cf27afb64e
@ -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…
x
Reference in New Issue
Block a user