-
Notifications
You must be signed in to change notification settings - Fork 15.2k
Closed
Labels
llvm:instcombineCovers the InstCombine, InstSimplify and AggressiveInstCombine passesCovers the InstCombine, InstSimplify and AggressiveInstCombine passesmissed-optimization
Description
https://alive2.llvm.org/ce/z/8asCzz
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.
Metadata
Metadata
Assignees
Labels
llvm:instcombineCovers the InstCombine, InstSimplify and AggressiveInstCombine passesCovers the InstCombine, InstSimplify and AggressiveInstCombine passesmissed-optimization