[PATCH] Implement variable-sized alloca instrumentation.
Kostya Serebryany
kcc at google.com
Tue Nov 18 13:18:41 PST 2014
================
Comment at: lib/Transforms/Instrumentation/AddressSanitizer.cpp:108
@@ -106,1 +107,3 @@
+const unsigned kAllocaRzSize = 32;
+const unsigned kAsanAllocaLeftMagic = 0xcacacacaU;
----------------
static
================
Comment at: lib/Transforms/Instrumentation/AddressSanitizer.cpp:541
@@ +540,3 @@
+ IRBuilder<> IRBRet(Ret);
+ IRBRet.CreateStore(ConstantInt::get(IRBRet.getInt32Ty(), 0),
+ AllocaCall.LeftRzAddr);
----------------
Constant::getNullValue
================
Comment at: lib/Transforms/Instrumentation/AddressSanitizer.cpp:560
@@ +559,3 @@
+ // Calculate PartialRzMagic.
+ Value *calculatePartialRzMagic(Value *PartialSize, IRBuilder<> &IRB) {
+ PartialSize = IRB.CreateIntCast(PartialSize, IRB.getInt32Ty(),
----------------
This deserves a comment: what exactly you are computing.
================
Comment at: lib/Transforms/Instrumentation/AddressSanitizer.cpp:584
@@ +583,3 @@
+
+ void handleDynamicAllocaCall(DynamicAllocaCall &AllocaCall) {
+ AllocaInst *AI = AllocaCall.AI;
----------------
These new functions are probably too big and should be placed outside of the class decl.
================
Comment at: lib/Transforms/Instrumentation/AddressSanitizer.cpp:586
@@ +585,3 @@
+ AllocaInst *AI = AllocaCall.AI;
+ IRBuilder<> IRB(AI);
+
----------------
write a function-level comment with the expression you are computing
================
Comment at: lib/Transforms/Instrumentation/AddressSanitizer.cpp:592
@@ +591,3 @@
+
+ Value *Zero = ConstantInt::get(IntptrTy, 0);
+ Value *AllocaRzSize = ConstantInt::get(IntptrTy, kAllocaRzSize);
----------------
Constant::getNullValue
================
Comment at: lib/Transforms/Instrumentation/AddressSanitizer.cpp:602
@@ +601,3 @@
+ unsigned ElementSize = ASan.DL->getTypeAllocSize(AI->getAllocatedType());
+ Value *OldSize = IRB.CreateMul(AI->getArraySize(),
+ ConstantInt::get(IntptrTy,
----------------
two lines should be enough here
http://reviews.llvm.org/D6055
More information about the llvm-commits
mailing list