[PATCH] D36430: [asan] Restore dead-code-elimination optimization for Fuchsia

Vitaly Buka via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Aug 7 16:42:56 PDT 2017


vitalybuka added a comment.

LGTM



================
Comment at: lib/asan/asan_malloc_linux.cc:35
   uptr off = (uptr)ptr - (uptr)alloc_memory_for_dlsym;
-  return off < sizeof(alloc_memory_for_dlsym);
+  return off < allocated_for_dlsym * sizeof(alloc_memory_for_dlsym[0]);
 }
----------------
mcgrathr wrote:
> vitalybuka wrote:
> > Maybe just to guard #if !defined(SANITIZER_FUCHSIA)
> > from line 29 to 64, and create empty implementation in #else section
> > 
> > 
> > 
> So, you mean exactly what I had originally in https://reviews.llvm.org/D36190?id=109395 before you asked me to change it to avoid #if tests?  Really?
> 
> I'll change it back if you want.  But you actually did convince me that avoiding #if here was better.
> If you are concerned about the correctness of this change (which I don't think you should be), then I can add a simple "&& !SANITIZER_FUCHSIA" short-circuit instead of this change.
I know, and actually now sure.
I don't like #ifs and I don't like multiple branches where they are not needed.

Correctness looks good to me, but all this hassle for optimization which can be omitted by compiler.

So I don't like all three approaches in the same degree :-)
Aleksey WDYT?


Repository:
  rL LLVM

https://reviews.llvm.org/D36430





More information about the llvm-commits mailing list