https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95685

--- Comment #1 from Jim Wilson <wilson at gcc dot gnu.org> ---
The problem with the constant isn't apparent until we reach RTL generation and
see that it requires two instructions to load.  Then once in RTL optimization
passes we have mostly block local optimizations that aren't going to notice the
same constant used in 3 different blocks and optimize it.  The if statement
inside the unrolled loop bodies prevent RTL optimization passes from fixing
this.  So yes, this would work better if we could do loop invariant code motion
before loop unrolling as you suggested.

Reply via email to