Revision (<<< Hide revision tags) (Show revision tags >>>) Date Author Comments
Revision tags: llvmorg-18.1.8, llvmorg-18.1.7, llvmorg-18.1.6, llvmorg-18.1.5, llvmorg-18.1.4, llvmorg-18.1.3, llvmorg-18.1.2, llvmorg-18.1.1, llvmorg-18.1.0, llvmorg-18.1.0-rc4, llvmorg-18.1.0-rc3, llvmorg-18.1.0-rc2, llvmorg-18.1.0-rc1, llvmorg-19-init, llvmorg-17.0.6, llvmorg-17.0.5, llvmorg-17.0.4, llvmorg-17.0.3, llvmorg-17.0.2, llvmorg-17.0.1, llvmorg-17.0.0, llvmorg-17.0.0-rc4, llvmorg-17.0.0-rc3, llvmorg-17.0.0-rc2, llvmorg-17.0.0-rc1, llvmorg-18-init, llvmorg-16.0.6, llvmorg-16.0.5
# 2622b2f4 23-May-2023 Noah Goldstein <goldstein.w.n@gmail.com>

[ValueTracking] Use `select` condition to help determine if `select` is non-zero

In `select c, x, y` the condition `c` dominates the resulting `x` or
`y` chosen by the `select`. This adds logic to `

[ValueTracking] Use `select` condition to help determine if `select` is non-zero

In `select c, x, y` the condition `c` dominates the resulting `x` or
`y` chosen by the `select`. This adds logic to `isKnownNonZero` to try
and use the `icmp` for the `c` condition to see if it implies the
select `x` or `y` are known non-zero.

For example in:
```
%c = icmp ugt i8 %x, %C
%r = select i1 %c, i8 %x, i8 %y
```
The true arm of select `%x` is non-zero (when "returned" by the
`select`) because `%c` being true implies `%x` is non-zero.

Alive2 Links (with `x {pred} C`):
- EQ iff `C != 0`:
- https://alive2.llvm.org/ce/z/umLabn
- NE iff `C == 0`:
- https://alive2.llvm.org/ce/z/DQvy8Y
- UGT [always]:
- https://alive2.llvm.org/ce/z/HBkjgQ
- UGE iff `C != 0`:
- https://alive2.llvm.org/ce/z/LDNifB
- SGT iff `C s>= 0`:
- https://alive2.llvm.org/ce/z/QzWDj3
- SGE iff `C s> 0`:
- https://alive2.llvm.org/ce/z/rR4g3D
- SLT iff `C s<= 0`:
- https://alive2.llvm.org/ce/z/uysayx
- SLE iff `C s< 0`:
- https://alive2.llvm.org/ce/z/2jYc7e

Reviewed By: nikic

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

show more ...


Revision tags: llvmorg-16.0.4, llvmorg-16.0.3
# 530bbc8f 30-Apr-2023 Noah Goldstein <goldstein.w.n@gmail.com>

[ValueTracking] Add tests for using condition in select for non-zero analysis; NFC

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