[InstSimplify] Simplify `select cond, undef, val` to `val` if `val = poison`...
[InstSimplify] Simplify `select cond, undef, val` to `val` if `val = poison` implies `cond = poison` (#76465)
This patch folds:
```
select cond, undef, val -> val
select cond, val, undef -> val
```
iff `impliesPoison(val, cond)` returns true.
Example:
```
define i32 @src1(i32 %retval.0.i.i) {
%cmp.i = icmp sgt i32 %retval.0.i.i, -1
%spec.select.i = select i1 %cmp.i, i32 %retval.0.i.i, i32 undef
ret i32 %spec.select.i
}
define i32 @tgt1(i32 %retval.0.i.i) {
ret i32 %retval.0.i.i
}
```
Alive2: https://alive2.llvm.org/ce/z/okJW3G
Compile-time impact:
http://llvm-compile-time-tracker.com/compare.php?from=38c9390b59c4d2b9181614d6a909887497d3692f&to=e146f51ba278aa3bb6879a9ec651831ac8938e91&stat=instructions%3Au
parent
3d7880b6
Please register or sign in to comment