Description
Reproducer: https://godbolt.org/z/aYWhfr6Y9
; bin/opt -passes=instcombine test.ll -S
define i32 @test(i32 noundef %0) {
entry:
%cond.i = call i32 @llvm.smax.i32(i32 %0, i32 0)
%conv.i = trunc i32 %cond.i to i16
%conv21 = zext i16 %conv.i to i32
%cmp22 = icmp eq i32 %0, %conv21
%conv23 = zext i1 %cmp22 to i32
%narrow.i = mul i32 %cond.i, %conv23
%1 = and i32 %narrow.i, 1
ret i32 %1
}