[PATCH] [asan] rewrite asan's stack frame layout

Alexey Samsonov samsonov at google.com
Thu Dec 5 07:36:20 PST 2013


  Please also address my comments to lib/Transforms/Instrumentation/AddressSanitizer.cpp from the previous round.


================
Comment at: include/llvm/Transforms/Utils/ASanStackFrameLayout.h:18
@@ +17,3 @@
+#include "llvm/ADT/SmallVector.h"
+#include "llvm/IR/Instructions.h"
+
----------------
You may use a forward declaration of AllocaInst instead of header here.

================
Comment at: include/llvm/Transforms/Utils/ASanStackFrameLayout.h:15
@@ +14,3 @@
+#define LLVM_TRANSFORMS_UTILS_ASANSTACKFRAMELAYOUT_H
+#include "llvm/ADT/ArrayRef.h"
+#include "llvm/ADT/SmallString.h"
----------------
ArrayRef is unused

================
Comment at: lib/Transforms/Instrumentation/AddressSanitizer.cpp:1403
@@ -1481,1 +1402,3 @@
 
+  SmallVector<ASanStackVariableDescription, 16> SVD;
+  SVD.reserve(AllocaVec.size());
----------------
Isn't 16 local variables too many?

================
Comment at: lib/Transforms/Instrumentation/AddressSanitizer.cpp:1470
@@ -1544,1 +1469,3 @@
+  for (size_t i = 0, n = SVD.size(); i < n; i++) {
+    AllocaInst *AI = static_cast<AllocaInst*>(SVD[i].AI);
     Value *NewAllocaPtr = IRB.CreateIntToPtr(
----------------
No more need in static_cast


http://llvm-reviews.chandlerc.com/D2324



More information about the llvm-commits mailing list