Please check opt output in https://alive2.llvm.org/ce/z/faj-Rl
instcombine transforms
define void @src10(i64 %src1) {
entry:
%1 = trunc i64 %src1 to i16
%2 = sext i16 %1 to i32
call void @use.i32(i32 %2)
ret void
}
into
define void @tgt10(i64 %src1) {
entry:
%1 = trunc i64 %src1 to i32
%2 = shl i32 %1, 16
%3 = ashr exact i32 %2, 16
call void @use.i32(i32 %3)
ret void
}
which should not be desired as the number of instructions increases.