summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms
diff options
context:
space:
mode:
authorEvgeniy Stepanov <eugeni.stepanov@gmail.com>2012-03-02 10:41:08 +0000
committerEvgeniy Stepanov <eugeni.stepanov@gmail.com>2012-03-02 10:41:08 +0000
commitd33e3d8c6e5f0d92451a3e56320b9f81ae664c50 (patch)
tree90fd6f716b9223e421c11740010a81adb3ac5e54 /llvm/lib/Transforms
parentbecfda3e40831b06814f18a119db36183f2476b4 (diff)
downloadbcm5719-llvm-d33e3d8c6e5f0d92451a3e56320b9f81ae664c50.tar.gz
bcm5719-llvm-d33e3d8c6e5f0d92451a3e56320b9f81ae664c50.zip
ASan: use getTypeAllocSize instead of getTypeStoreSize.
This change replaces getTypeStoreSize with getTypeAllocSize in AddressSanitizer instrumentation for stack allocations. One case where old behaviour produced undesired results is an optimization in InstCombine pass (PromoteCastOfAllocation), which can replace alloca(T) with alloca(S), where S has the same AllocSize, but a smaller StoreSize. Another case is memcpy(long double => long double), where ASan will poison bytes 10-15 of a stack-allocated long double (StoreSize 10, AllocSize 16, sizeof(long double) = 16). See http://llvm.org/bugs/show_bug.cgi?id=12047 for more context. llvm-svn: 151887
Diffstat (limited to 'llvm/lib/Transforms')
-rw-r--r--llvm/lib/Transforms/Instrumentation/AddressSanitizer.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/llvm/lib/Transforms/Instrumentation/AddressSanitizer.cpp b/llvm/lib/Transforms/Instrumentation/AddressSanitizer.cpp
index ce5d43a68fc..123e3990423 100644
--- a/llvm/lib/Transforms/Instrumentation/AddressSanitizer.cpp
+++ b/llvm/lib/Transforms/Instrumentation/AddressSanitizer.cpp
@@ -167,7 +167,7 @@ struct AddressSanitizer : public ModulePass {
uint64_t getAllocaSizeInBytes(AllocaInst *AI) {
Type *Ty = AI->getAllocatedType();
- uint64_t SizeInBytes = TD->getTypeStoreSizeInBits(Ty) / 8;
+ uint64_t SizeInBytes = TD->getTypeAllocSize(Ty);
return SizeInBytes;
}
uint64_t getAlignedSize(uint64_t SizeInBytes) {
OpenPOWER on IntegriCloud