[PATCH] asan: do not instrument direct inbounds accesses to stack variables

Daniel Berlin dberlin at dberlin.org
Tue Mar 3 12:50:25 PST 2015


FWIW: This optimization looks right to me.
GVN uses similar logic to do an optimization to loads it can prove come directly from allocation functions.


================
Comment at: lib/Transforms/Instrumentation/AddressSanitizer.cpp:2071
@@ +2070,3 @@
+                                        Value *Addr, uint64_t TypeSize) const {
+  SizeOffsetType SizeOffset = ObjSizeVis.compute(Addr);
+  if (!ObjSizeVis.bothKnown(SizeOffset))
----------------
You may want to look if this does a better/worse job than GetPointerBaseWithConstantOffset

(This is what GVN, DeadStoreElimination, etc use to do what you are doing here - compute the pointer base and constant offset, make sure they match, then they use getTypeSizeInBits to compare the sizes)

http://reviews.llvm.org/D7583

EMAIL PREFERENCES
  http://reviews.llvm.org/settings/panel/emailpreferences/






More information about the llvm-commits mailing list