diff options
author | Yingwei Zheng <dtcxzyw2333@gmail.com> | 2023-12-28 23:37:19 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-12-28 23:37:19 +0800 |
commit | 554feb0058980ae3c6159a61ffdae2c2d345bf7a (patch) | |
tree | d05e65e7a4dd1542ed04d1d04be6b44ede07ee6c /flang/lib/Frontend/CompilerInvocation.cpp | |
parent | 3d7880b64ca7746f7f5de5acc73afa23cedf94d2 (diff) | |
download | llvm-554feb0058980ae3c6159a61ffdae2c2d345bf7a.zip llvm-554feb0058980ae3c6159a61ffdae2c2d345bf7a.tar.gz llvm-554feb0058980ae3c6159a61ffdae2c2d345bf7a.tar.bz2 |
[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
Diffstat (limited to 'flang/lib/Frontend/CompilerInvocation.cpp')
0 files changed, 0 insertions, 0 deletions