[PATCH] D21165: Disable MSan-hostile loop unswitching.

Evgeniy Stepanov via llvm-commits llvm-commits at lists.llvm.org
Thu Jun 9 16:07:06 PDT 2016


eugenis added a comment.

Here is another example where it is basically impossible for MSan to propagate initializeness information exactly after the unswitching optimization.

This loop is unswitched on y, then we have 2 copies of the loop calculating "a" and phi + ret at the end. When y is undef, if we just track a single-bit "control flow is poisoned" state, we end up with "a" being undef, too. To conclude that a is defined MSan has to prove that both loops calculate "a" with the same sequence of operations which sounds impossible in the general case.

volatile int sink;
// y = undef
// z = 1
int f(bool y, unsigned z) {

  int a = 42;
  for (int i = 0; i < z; ++i) {
    if (i)
      if (y)
        sink = 1;
    a ^= 123;
  }
  return a;

}


Repository:
  rL LLVM

http://reviews.llvm.org/D21165





More information about the llvm-commits mailing list