Commit b34275e4 by Nicolas Capens Committed by Nicolas Capens

Emulate gather/scatter for MSan builds

MemorySanitizer doesn't support instrumenting masked_gather and masked_scatter LLVM intrinsics. Its visitIntrinsicInst() method ends up calling handleUnknownIntrinsic(), which silently doesn't handle it and subsequently visitInstruction() checks all operands for poisoned bits. In the case of a scatter, a 0 bit in the mask means the corresponding element doesn't get written, so it doesn't matter if it's uninitialized data. The current implementation leads to false positives. Work around it by emulating gather and scatter as element-wise loads and stores. This can be correctly instrumented by MemorySanitizer. Note this change has no effect currently since we don't support MSan instrumentation for Reactor yet. We just unpoison all stores. Previously we did that in element-wise manner after the intrinsic executes. Now it's done as part of the element stores. Bug: b/155148722 Change-Id: I9058cd926667fb6df5d9626bc87fb2d0a596771b Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/49809Tested-by: 's avatarNicolas Capens <nicolascapens@google.com> Reviewed-by: 's avatarAntonio Maiorano <amaiorano@google.com>
parent 782dbebf
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment