Skip to content

Commit 77c90eb

Browse files
committed
[ASAN] Use AI.getAllocationSize() helper (NFC)
1 parent 8bdf387 commit 77c90eb

File tree

1 file changed

+1
-10
lines changed

1 file changed

+1
-10
lines changed

llvm/lib/Transforms/Instrumentation/AddressSanitizer.cpp

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -668,16 +668,7 @@ struct AddressSanitizer {
668668
}
669669

670670
TypeSize getAllocaSizeInBytes(const AllocaInst &AI) const {
671-
uint64_t ArraySize = 1;
672-
if (AI.isArrayAllocation()) {
673-
const ConstantInt *CI = dyn_cast<ConstantInt>(AI.getArraySize());
674-
assert(CI && "non-constant array size");
675-
ArraySize = CI->getZExtValue();
676-
}
677-
Type *Ty = AI.getAllocatedType();
678-
TypeSize SizeInBytes =
679-
AI.getModule()->getDataLayout().getTypeAllocSize(Ty);
680-
return SizeInBytes * ArraySize;
671+
return *AI.getAllocationSize(AI.getModule()->getDataLayout());
681672
}
682673

683674
/// Check if we want (and can) handle this alloca.

0 commit comments

Comments
 (0)