https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109393
--- Comment #6 from manolis.tsamis at vrull dot eu --- (In reply to Richard Biener from comment #5) > (In reply to manolis.tsamis from comment #4) > > Given the original transform it should be valid to propagate the constant > > addition through the cast? > > Yes. Note doing so loses information, we know i + 1 doesn't overflow > (undefined behavior). Widening preserves this knowledge I think, but if > just an unsigned conversion would be propagated it would be lost. So, is that the reason that this transform isn't already implemented as an optimisation? But then again isn't this information also lost in the code currently produced by GCC, where the constant is already propagated? Although I can see how it is different to do the propagation of constants in the front-end only vs doing it anywhere while transforming the code; maybe that's the difference that matters. But hopefully doing better canonicalization/constant folding on address calculations and constants should also result in better optimisation opportunities overall.