[PATCH] Implement variable-sized alloca instrumentation.

Kostya Serebryany kcc at google.com
Wed Nov 19 14:13:53 PST 2014


================
Comment at: lib/Transforms/Instrumentation/AddressSanitizer.cpp:476
@@ -466,1 +475,3 @@
 
+  // Stores left, partial and right redzone shadow addresses for dynamic alloca
+  // and pointer to alloca instruction itself.
----------------
remove "partial" from comment

================
Comment at: lib/Transforms/Instrumentation/AddressSanitizer.cpp:559
@@ +558,3 @@
+  // If PartialSize is 0, PartialRzMagic would also be 0, otherwise it would
+  // contain the value by that we will poison partial redzone for alloca call.
+  Value *computePartialRzMagic(Value *PartialSize, IRBuilder<> &IRB);
----------------
rephrase somehow, e.g.

... it would contain the value that we will use to poison the partial redzone

================
Comment at: lib/Transforms/Instrumentation/AddressSanitizer.cpp:1816
@@ +1815,3 @@
+
+Value *FunctionStackPoisoner::computePartialRzMagic(Value *PartialSize,
+                                                    IRBuilder<> &IRB) {
----------------
please add a comment similar to the comment before handleDynamicAllocaCall
explaining what exactly and how you compute here, because this part is nto completely trivial. 

================
Comment at: lib/Transforms/Instrumentation/AddressSanitizer.cpp:1837
@@ +1836,3 @@
+                                           "partial_bits", Val2);
+  Val2->setOperand(0, Partial);
+  return IRB.CreateOr(Val1, Val2);
----------------
I tried hard, but I don't understand this :( 
Try to avoid setOperand, instead create new Instruction objects when needed. 


================
Comment at: lib/Transforms/Instrumentation/AddressSanitizer.cpp:1914
@@ +1913,3 @@
+  Value *RightRzAddress = IRB.CreateAnd(IRB.CreateAdd(PartialRzAddr,
+                                                      AllocaRzMask),
+                                        NotAllocaRzMask);
----------------
two lines, please. 
(You will like clang-format if you try it)

http://reviews.llvm.org/D6055






More information about the llvm-commits mailing list