[PATCH] D46459: [asan] Make GetCurrentThread RTEMS-friendly

Vitaly Buka via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri May 18 10:55:31 PDT 2018


vitalybuka added inline comments.


================
Comment at: compiler-rt/lib/asan/asan_thread.cc:394
+    return nullptr;
+
   AsanThreadContext *context =
----------------
alekseyshl wrote:
> vitalybuka wrote:
> > What if you just put here and we avoid platform specific branch
> > ```
> > if (UNLIKELY(!asan_inited))
> >   AsanInitFromRtl();
> > ```
> > 
> > !asan_inited is not expected here on any other platform
> But it still be a check, still some code executed, even if it is unlikely. With SANITIZER_RTEMS, it will be removed on all platforms, but RTEMS.
> 
> The semantics is also wrong, this way it creates an impression that it can happen on all platforms.
With first part I agree, we don't want additional check here as this can be called quite frequently.  So it makes sense to move AsanInitFromRtl() into __asan_handle_no_return

For semantics, I'd rather have as much as possible same function on all platform, even if it handles cases which are not necessary on some of them.


Repository:
  rL LLVM

https://reviews.llvm.org/D46459





More information about the llvm-commits mailing list