[llvm-commits] [PATCH] Try to figure out <size> argument in llvm.lifetime intrinsics
Alexey Samsonov
samsonov at google.com
Mon Nov 12 01:22:37 PST 2012
Kostya is right about merging allocas - stack reuse won't be able to do anything if ASan is enabled.
================
Comment at: lib/Transforms/Utils/InlineFunction.cpp:676
@@ +675,3 @@
+ if (IFI.TD != 0) {
+ uint64_t SizeValue = AllocaArraySize->getLimitedValue();
+ Type *AllocaType = AI->getAllocatedType();
----------------
Nick Lewycky wrote:
> What if the array size is an i128, and greater than fits in a uint64_t? getLimitedValue() will return -1 (~0ULL). Maybe you want to bail in that case?
Done
================
Comment at: lib/Transforms/Utils/InlineFunction.cpp:678
@@ +677,3 @@
+ Type *AllocaType = AI->getAllocatedType();
+ SizeValue *= IFI.TD->getTypeAllocSize(AllocaType);
+ AllocaSize = ConstantInt::get(Type::getInt64Ty(AI->getContext()),
----------------
Nick Lewycky wrote:
> What about overflow here?
>
> I don't know of any shared utility to multiply and detect overflow, but I've needed to do the exact same thing before. See umul_ov() at ScalarEvolution.cpp:1826.
>
Done
http://llvm-reviews.chandlerc.com/D110
More information about the llvm-commits
mailing list