[InlineFunction] Don't add lifetime markers for zero-sized allocas.

This commit fixes the code which adds lifetime markers in InlineFunction to skip
zero-sized allocas instead of asserting on them.

rdar://problem/20531155


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@235312 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Akira Hatanaka
2015-04-20 16:11:05 +00:00
parent d9b36e1007
commit ca9313e65e
2 changed files with 29 additions and 1 deletions

View File

@@ -1167,7 +1167,11 @@ bool llvm::InlineFunction(CallSite CS, InlineFunctionInfo &IFI,
Type *AllocaType = AI->getAllocatedType();
uint64_t AllocaTypeSize = DL.getTypeAllocSize(AllocaType);
uint64_t AllocaArraySize = AIArraySize->getLimitedValue();
assert(AllocaArraySize > 0 && "array size of AllocaInst is zero");
// Don't add markers for zero-sized allocas.
if (AllocaArraySize == 0)
continue;
// Check that array size doesn't saturate uint64_t and doesn't
// overflow when it's multiplied by type size.
if (AllocaArraySize != ~0ULL &&