MCPcopy Create free account
hub / github.com/catboost/catboost / DoNotOptimizeAway

Function DoNotOptimizeAway

util/system/compiler.h:644–655  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

642
643template <typename T>
644Y_FORCE_INLINE void DoNotOptimizeAway(T&& datum) {
645 #if defined(_MSC_VER)
646 UseCharPointerImpl(&reinterpret_cast<volatile const char&>(datum));
647 _ReadWriteBarrier();
648 #elif defined(__GNUC__) && defined(_x86_)
649 asm volatile(""
650 :
651 : "X"(datum));
652 #else
653 Y_FAKE_READ(datum);
654 #endif
655}
656
657/**
658 * The usage for `const T&` is prohibited.

Callers 1

DoNotOptimizeFunction · 0.85

Calls 1

UseCharPointerImplFunction · 0.85

Tested by

no test coverage detected