[compiler-rt] r178341 - [tsan] restore performance critical inlining in tsan: remove static from ALWAYS_INLINE, use ALWAYS_INLINE USED for critical functions.

Timur Iskhodzhanov timurrrr at google.com
Fri Apr 12 04:03:53 PDT 2013


Be warned that droping "static" in the ALWAYS_INLINE could introduce a
possibility of ODRs in other places where ALWAYS_INLINE is used.

2013/3/29 Kostya Serebryany <kcc at google.com>:
> Author: kcc
> Date: Fri Mar 29 04:44:16 2013
> New Revision: 178341
>
> URL: http://llvm.org/viewvc/llvm-project?rev=178341&view=rev
> Log:
> [tsan] restore performance critical inlining in tsan: remove static from ALWAYS_INLINE, use ALWAYS_INLINE USED for critical functions.
>
> Modified:
>     compiler-rt/trunk/lib/sanitizer_common/sanitizer_internal_defs.h
>     compiler-rt/trunk/lib/tsan/rtl/tsan_rtl.cc
>
> Modified: compiler-rt/trunk/lib/sanitizer_common/sanitizer_internal_defs.h
> URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/sanitizer_common/sanitizer_internal_defs.h?rev=178341&r1=178340&r2=178341&view=diff
> ==============================================================================
> --- compiler-rt/trunk/lib/sanitizer_common/sanitizer_internal_defs.h (original)
> +++ compiler-rt/trunk/lib/sanitizer_common/sanitizer_internal_defs.h Fri Mar 29 04:44:16 2013
> @@ -130,7 +130,7 @@ using namespace __sanitizer;  // NOLINT
>  # define USED
>  # define PREFETCH(x) /* _mm_prefetch(x, _MM_HINT_NTA) */
>  #else  // _MSC_VER
> -# define ALWAYS_INLINE static inline __attribute__((always_inline))
> +# define ALWAYS_INLINE inline __attribute__((always_inline))
>  # define ALIAS(x) __attribute__((alias(x)))
>  # define ALIGNED(x) __attribute__((aligned(x)))
>  # define FORMAT(f, a)  __attribute__((format(printf, f, a)))
>
> Modified: compiler-rt/trunk/lib/tsan/rtl/tsan_rtl.cc
> URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/tsan/rtl/tsan_rtl.cc?rev=178341&r1=178340&r2=178341&view=diff
> ==============================================================================
> --- compiler-rt/trunk/lib/tsan/rtl/tsan_rtl.cc (original)
> +++ compiler-rt/trunk/lib/tsan/rtl/tsan_rtl.cc Fri Mar 29 04:44:16 2013
> @@ -385,7 +385,7 @@ static inline bool HappensBefore(Shadow
>    return thr->clock.get(old.TidWithIgnore()) >= old.epoch();
>  }
>
> -// FIXME: should be ALWAYS_INLINE for performance reasons?
> +ALWAYS_INLINE USED
>  void MemoryAccessImpl(ThreadState *thr, uptr addr,
>      int kAccessSizeLog, bool kAccessIsWrite, bool kIsAtomic,
>      u64 *shadow_mem, Shadow cur) {
> @@ -459,7 +459,7 @@ void MemoryAccessImpl(ThreadState *thr,
>    return;
>  }
>
> -// FIXME: should be ALWAYS_INLINE for performance reasons?
> +ALWAYS_INLINE USED
>  void MemoryAccess(ThreadState *thr, uptr pc, uptr addr,
>      int kAccessSizeLog, bool kAccessIsWrite, bool kIsAtomic) {
>    u64 *shadow_mem = (u64*)MemToShadow(addr);
> @@ -597,7 +597,7 @@ void MemoryRangeImitateWrite(ThreadState
>    MemoryRangeSet(thr, pc, addr, size, s.raw());
>  }
>
> -// FIXME: should be ALWAYS_INLINE for performance reasons?
> +ALWAYS_INLINE USED
>  void FuncEntry(ThreadState *thr, uptr pc) {
>    DCHECK_EQ(thr->in_rtl, 0);
>    StatInc(thr, StatFuncEnter);
> @@ -627,7 +627,7 @@ void FuncEntry(ThreadState *thr, uptr pc
>    thr->shadow_stack_pos++;
>  }
>
> -// FIXME: should be ALWAYS_INLINE for performance reasons?
> +ALWAYS_INLINE USED
>  void FuncExit(ThreadState *thr) {
>    DCHECK_EQ(thr->in_rtl, 0);
>    StatInc(thr, StatFuncExit);
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits



More information about the llvm-commits mailing list