[llvm] [InstCombine] Use the select condition to try to constant fold binops into select (PR #84696)
Yingwei Zheng via llvm-commits
llvm-commits at lists.llvm.org
Mon Mar 11 02:06:42 PDT 2024
dtcxzyw wrote:
```
define i32 @before(i1 %cond) {
%sel = select i1 %cond, i32 32, i32 0
call void @use(i32 %sel)
%ret = or disjoint i32 %sel, 16
ret i32 %ret
}
define i32 @after(i1 %cond) {
%sel = select i1 %cond, i32 32, i32 0
call void @use(i32 %sel)
%ret = select i1 %cond, i32 48, i32 16
ret i32 %ret
}
```
I don't think the latter form is better than the former. Do we need the one-use check?
https://github.com/llvm/llvm-project/pull/84696
More information about the llvm-commits
mailing list