bjope wrote: Is the behavior seen in this example expected? https://godbolt.org/z/f8eqEnsq6
The comments in InstCombineCompares kind of indicates that you try to avoid changing a signed predicate to a unsigned. But isn't that what happens here. As well as increasing the instruction count by introducing a zext instruction. Main problem I have with this example is that downstream indvars later is doing ``` INDVARS: Rewriting loop exit condition to: LHS: %inc = add nuw nsw i16 %j.046, 1 op: != RHS: %umax = call i16 @llvm.umax.i16(i16 %shr, i16 1) ExitCount: (-1 + (1 umax (%n2.053 /u 2)))<nsw> was: %cmp2 = icmp ult i16 %inc, %shr ``` and that increases the instruction count by inserting an umax in the for.body3.preheader. This later seem to result in a cycle regression. I think you can see something a bit similar if running `opt -passes=instcombine,indvars -mtriple i386`. https://github.com/llvm/llvm-project/pull/73662 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits