Issue |
158326
|
Summary |
[InstCombine] Simplify range check + mask check
|
Labels |
llvm:instcombine,
missed-optimization
|
Assignees |
|
Reporter |
nikic
|
https://alive2.llvm.org/ce/z/8asCzz
```llvm
define i1 @src(i8 %a) {
%cmp1 = icmp ult i8 %a, 5
%masked = and i8 %a, -2
%cmp2 = icmp eq i8 %masked, 2
%and = and i1 %cmp1, %cmp2
ret i1 %and
}
define i1 @tgt(i8 %a) {
%masked = and i8 %a, -2
%cmp2 = icmp eq i8 %masked, 2
ret i1 %cmp2
}
```
In this example the mask check only satisfies 2 and 3, both of which are < 5, so the range check is redundant.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs