https://gcc.gnu.org/bugzilla/show_bug.cgi?id=117859
--- Comment #6 from GCC Commits <cvs-commit at gcc dot gnu.org> --- The trunk branch has been updated by Andrew Pinski <pins...@gcc.gnu.org>: https://gcc.gnu.org/g:24949e640307f91a831e0fb699fea85fb9276a09 commit r15-5843-g24949e640307f91a831e0fb699fea85fb9276a09 Author: Andrew Pinski <quic_apin...@quicinc.com> Date: Sat Nov 30 13:12:13 2024 -0800 gimple-lim: Reuse boolean var when moving PHI While looking into PR 117859, I noticed that LIM sometimes would produce `bool_var2 = bool_var1 != 0` instead of just using bool_var2. This patch allows LIM to reuse bool_var1 in the place where bool_var2 was going to be used. Bootstrapped and tested on x86_64-linux-gnu. gcc/ChangeLog: * tree-ssa-loop-im.cc (move_computations_worker): While moving phi, reuse the lhs of the conditional if it is a boolean type. Signed-off-by: Andrew Pinski <quic_apin...@quicinc.com>