[all-commits] [llvm/llvm-project] a6183d: [ValueTracking] isKnownNonZero, computeKnownBits f...

Juneyoung Lee via All-commits all-commits at lists.llvm.org
Wed Sep 9 16:08:16 PDT 2020


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: a6183d0f028cb73eccc82a7cce9534708a149762
      https://github.com/llvm/llvm-project/commit/a6183d0f028cb73eccc82a7cce9534708a149762
  Author: Juneyoung Lee <aqjune at gmail.com>
  Date:   2020-09-10 (Thu, 10 Sep 2020)

  Changed paths:
    M llvm/lib/Analysis/ValueTracking.cpp
    M llvm/test/Transforms/InstSimplify/known-non-zero.ll
    M llvm/unittests/Analysis/ValueTrackingTest.cpp

  Log Message:
  -----------
  [ValueTracking] isKnownNonZero, computeKnownBits for freeze

This implements support for isKnownNonZero, computeKnownBits when freeze is involved.

```
  br (x != 0), BB1, BB2
BB1:
  y = freeze x
```

In the above program, we can say that y is non-zero. The reason is as follows:

(1) If x was poison, `br (x != 0)` raised UB
(2) If x was fully undef, the branch again raised UB
(3) If x was non-zero partially undef, say `undef | 1`, `freeze x` will return a nondeterministic value which is also non-zero.
(4) If x was just a concrete value, it is trivial

Reviewed By: nikic

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




More information about the All-commits mailing list