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

Aleksey Shlyapnikov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Aug 7 16:50:09 PDT 2017


alekseyshl accepted this revision.
alekseyshl added inline comments.
This revision is now accepted and ready to land.


================
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]);
 }
----------------
vitalybuka wrote:
> 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?
I guess it's fine, the extra multiplication should not be a problem (it should be compiled into shift anyway). If it is going to cause any issues, we will convert it into actual offset, not an index.


Repository:
  rL LLVM

https://reviews.llvm.org/D36430





More information about the llvm-commits mailing list