[llvm] r371461 - LangRef: mention MSan's problem with speculative conditional branches.

Evgeniy Stepanov via llvm-commits llvm-commits at lists.llvm.org
Mon Sep 9 15:24:57 PDT 2019


Author: eugenis
Date: Mon Sep  9 15:24:57 2019
New Revision: 371461

URL: http://llvm.org/viewvc/llvm-project?rev=371461&view=rev
Log:
LangRef: mention MSan's problem with speculative conditional branches.

Summary:
This short blurb aims to disallow optimizations like we had to revert
(under MSan) in
  https://reviews.llvm.org/D21165
  https://bugs.llvm.org/show_bug.cgi?id=28054
  https://reviews.llvm.org/D67205

Reviewers: vitalybuka, efriedma

Subscribers: llvm-commits

Tags: #llvm

Differential Revision: https://reviews.llvm.org/D67244

Modified:
    llvm/trunk/docs/LangRef.rst

Modified: llvm/trunk/docs/LangRef.rst
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/docs/LangRef.rst?rev=371461&r1=371460&r2=371461&view=diff
==============================================================================
--- llvm/trunk/docs/LangRef.rst (original)
+++ llvm/trunk/docs/LangRef.rst Mon Sep  9 15:24:57 2019
@@ -3245,6 +3245,17 @@ match what was already there. However, a
 location could clobber arbitrary memory, therefore, it has undefined
 behavior.
 
+**MemorySanitizer**, a detector of uses of uninitialized memory,
+defines a branch with condition that depends on an undef value (or
+certain other values, like e.g. a result of a load from heap-allocated
+memory that has never been stored to) to have an externally visible
+side effect. For this reason functions with *sanitize_memory*
+attribute are not allowed to produce such branches "out of thin
+air". More strictly, an optimization that inserts a conditional branch
+is only valid if in all executions where the branch condition has at
+least one undefined bit, the same branch condition is evaluated in the
+input IR as well.
+
 .. _poisonvalues:
 
 Poison Values




More information about the llvm-commits mailing list