[all-commits] [llvm/llvm-project] 554feb: [InstSimplify] Simplify `select cond, undef, val` ...
Yingwei Zheng via All-commits
all-commits at lists.llvm.org
Thu Dec 28 07:37:32 PST 2023
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: 554feb0058980ae3c6159a61ffdae2c2d345bf7a
https://github.com/llvm/llvm-project/commit/554feb0058980ae3c6159a61ffdae2c2d345bf7a
Author: Yingwei Zheng <dtcxzyw2333 at gmail.com>
Date: 2023-12-28 (Thu, 28 Dec 2023)
Changed paths:
M llvm/lib/Analysis/InstructionSimplify.cpp
M llvm/test/Transforms/InstCombine/select.ll
M llvm/test/Transforms/InstSimplify/select-inseltpoison.ll
M llvm/test/Transforms/InstSimplify/select.ll
Log Message:
-----------
[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
More information about the All-commits
mailing list