[PATCH] Skip promotable allocas to improve performance at -O0

Kostya Serebryany kcc at google.com
Mon Feb 23 16:01:42 PST 2015


Indeed, Chandler, I actually don't see why this could lead to false positives? What do we miss?


================
Comment at: lib/Transforms/Instrumentation/AddressSanitizer.cpp:798
@@ -788,3 +797,3 @@
     *Alignment = LI->getAlignment();
-    return LI->getPointerOperand();
+    PtrOperand = LI->getPointerOperand();
   }
----------------
You will now execute all other if statements even if the first one is true. At leats change the following ifs to "else if", or preserve the structure with 'return' and have another function that checks isAllocaPromotable

================
Comment at: lib/Transforms/Instrumentation/AddressSanitizer.cpp:823
@@ +822,3 @@
+  if (auto AI = dyn_cast_or_null<AllocaInst>(PtrOperand))
+    if (ClSkipPromotableAllocas)
+      return isAllocaPromotable(AI) ? nullptr : AI;
----------------
exchange the order of ifs?

http://reviews.llvm.org/D7741

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






More information about the llvm-commits mailing list