void clear(uint16_t *memory, uint16_t element, size_t count)
{
- #if defined(_MSC_VER) && defined(__x86__)
+ #if defined(_MSC_VER) && defined(__x86__) && !defined(MEMORY_SANITIZER)
__stosw(memory, element, count);
- #elif defined(__GNUC__) && defined(__x86__)
+ #elif defined(__GNUC__) && defined(__x86__) && !defined(MEMORY_SANITIZER)
__asm__("rep stosw" : : "D"(memory), "a"(element), "c"(count));
#else
for(size_t i = 0; i < count; i++)
void clear(uint32_t *memory, uint32_t element, size_t count)
{
- #if defined(_MSC_VER) && defined(__x86__)
+ #if defined(_MSC_VER) && defined(__x86__) && !defined(MEMORY_SANITIZER)
__stosd((unsigned long*)memory, element, count);
- #elif defined(__GNUC__) && defined(__x86__)
+ #elif defined(__GNUC__) && defined(__x86__) && !defined(MEMORY_SANITIZER)
__asm__("rep stosl" : : "D"(memory), "a"(element), "c"(count));
#else
for(size_t i = 0; i < count; i++)
#include "llvm/Support/FileSystem.h"
#include "llvm/Support/raw_os_ostream.h"
+#include "llvm/Support/Compiler.h"
+
+#if __has_feature(memory_sanitizer)
+#include <sanitizer/msan_interface.h>
+#endif
#if defined(_WIN32)
#ifndef WIN32_LEAN_AND_MEAN
Value *Nucleus::createStore(Value *value, Value *ptr, Type *type, bool isVolatile, unsigned int align)
{
+ #if __has_feature(memory_sanitizer)
+ // Mark all (non-stack) memory writes as initialized by calling __msan_unpoison
+ if(align != 0)
+ {
+ auto call = Ice::InstCall::create(::function, 2, nullptr, ::context->getConstantInt64(reinterpret_cast<intptr_t>(__msan_unpoison)), false);
+ call->addArg(ptr);
+ call->addArg(::context->getConstantInt64(typeSize(type)));
+ ::basicBlock->appendInst(call);
+ }
+ #endif
+
int valueType = (int)reinterpret_cast<intptr_t>(type);
if((valueType & EmulatedBits) && (align != 0)) // Narrow vector not stored on stack.
return;
}
- // The memory sanitizer doesn't work with JIT compiled code
- #if !defined(MEMORY_SANITIZER)
- if(blitReactor(source, sourceRect, dest, destRect, options))
- {
- return;
- }
- #endif
+ if(blitReactor(source, sourceRect, dest, destRect, options))
+ {
+ return;
+ }
SliceRectF sRect = sourceRect;
SliceRect dRect = destRect;