[PATCH] D19781: [ASan] Disable target-specific lowering of string functions.

Filipe Cabecinhas via llvm-commits llvm-commits at lists.llvm.org
Mon May 2 04:15:20 PDT 2016


filcab added a subscriber: filcab.
filcab added a comment.

Thanks for working on this.
Can you split this patch in two, please?
The SelectionDAG + CodeGen tests on one, the ASan-specific code on another.
Not having a proper way to test SelectionDAG is annoying. To have perfecct coverage, we'd need to replicate those tests for other targets. This will do for now, though. :-)

BTW, have you measured performance impact?
If it's too big, we probably want to put this under a flag (the sanitizer philosophy is that we know we have false negatives, but no false positives, so it fits not doing this by default if it's a big performance hit).


================
Comment at: lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp:6177
@@ -6176,3 +6176,3 @@
         LibInfo->getLibFunc(F->getName(), Func) &&
-        LibInfo->hasOptimizedCodeGen(Func)) {
+        LibInfo->hasOptimizedCodeGen(Func) && !I.isNoBuiltin()) {
       switch (Func) {
----------------
We probably want to check for `isNoBuiltin` before we query `LibInfo`, which involves lookups.

================
Comment at: lib/Transforms/Instrumentation/AddressSanitizer.cpp:1859
@@ +1858,3 @@
+    case LibFunc::strlen:
+    case LibFunc::strnlen:
+      CI->addAttribute(AttributeSet::FunctionIndex, Attribute::NoBuiltin);
----------------
We probably want to add some of the other intercepted functions (but instead of duplicating everything, I guess it's better to only add those that actually have special handling).
That can be a follow up patch, though, as needed.



Repository:
  rL LLVM

http://reviews.llvm.org/D19781





More information about the llvm-commits mailing list