GCC r15-6929 optimizes 1 >> x to x == 0
LLVM trunk miss this optimization this pattern with -O3:
LLVM IR:
define i32 @src(i32 %a) {
entry:
%shr = lshr i32 1, %a
ret i32 %shr
}
define i32 @tgt(i32 %a) {
entry:
%cmp = icmp eq i32 %a, 0
%conv = zext i1 %cmp to i32
ret i32 %conv
}
GCC r15-6929 optimizes 1 >> x to x == 0
LLVM trunk miss this optimization this pattern with -O3:
LLVM IR: