https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93939
--- Comment #1 from Marc Glisse <glisse at gcc dot gnu.org> --- typedef long T; also generates a comparison with 24. The main issue is that b is used outside of the branch controlled by if(b==8), so a naive substitution misses it. Repeating 3*b in the branch is useless, we CSE it anyway. Still, DOM manages the optimization for int, so there is hope.