[Bug tree-optimization/95685] Loop invariants can't be moved out of the loop

wilson at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Tue Jun 16 00:31:28 GMT 2020


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.


More information about the Gcc-bugs mailing list