[llvm] r279222 - [asan] Fix size of shadow incorrectly calculated in r279178
Vitaly Buka via llvm-commits
llvm-commits at lists.llvm.org
Fri Aug 19 01:33:53 PDT 2016
Author: vitalybuka
Date: Fri Aug 19 03:33:53 2016
New Revision: 279222
URL: http://llvm.org/viewvc/llvm-project?rev=279222&view=rev
Log:
[asan] Fix size of shadow incorrectly calculated in r279178
Summary: r279178 generates 8 times more stores than necessary.
Reviewers: eugenis
Subscribers: llvm-commits
Differential Revision: https://reviews.llvm.org/D23708
Modified:
llvm/trunk/lib/Transforms/Instrumentation/AddressSanitizer.cpp
llvm/trunk/test/Instrumentation/AddressSanitizer/stack-poisoning.ll
Modified: llvm/trunk/lib/Transforms/Instrumentation/AddressSanitizer.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Instrumentation/AddressSanitizer.cpp?rev=279222&r1=279221&r2=279222&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/Instrumentation/AddressSanitizer.cpp (original)
+++ llvm/trunk/lib/Transforms/Instrumentation/AddressSanitizer.cpp Fri Aug 19 03:33:53 2016
@@ -2237,10 +2237,8 @@ void FunctionStackPoisoner::poisonStack(
IRBuilder<> IRBPoison(ThenTerm);
if (StackMallocIdx <= 4) {
int ClassSize = kMinStackMallocSize << StackMallocIdx;
- if ((int)ShadowBytesAfterReturn.size() != ClassSize) {
- ShadowBytesAfterReturn.resize(ClassSize,
- kAsanStackUseAfterReturnMagic);
- }
+ ShadowBytesAfterReturn.resize(ClassSize >> Mapping.Scale,
+ kAsanStackUseAfterReturnMagic);
poisonRedZones(ShadowBytesAfterReturn, IRBPoison, ShadowBase, true);
Value *SavedFlagPtrPtr = IRBPoison.CreateAdd(
FakeStack,
Modified: llvm/trunk/test/Instrumentation/AddressSanitizer/stack-poisoning.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Instrumentation/AddressSanitizer/stack-poisoning.ll?rev=279222&r1=279221&r2=279222&view=diff
==============================================================================
--- llvm/trunk/test/Instrumentation/AddressSanitizer/stack-poisoning.ll (original)
+++ llvm/trunk/test/Instrumentation/AddressSanitizer/stack-poisoning.ll Fri Aug 19 03:33:53 2016
@@ -44,6 +44,7 @@ entry:
; CHECK-UAR: store i64 -723401728380766731
; CHECK-UAR: store i64 -723401728380766731
; CHECK-UAR: store i64 -723401728380766731
+ ; CHECK-UAR-NOT: store i64
; CHECK-UAR: store i8 0
; CHECK-UAR-NOT: store
; CHECK-UAR: label
More information about the llvm-commits
mailing list