https://gcc.gnu.org/bugzilla/show_bug.cgi?id=121570
--- Comment #13 from Andi Kleen <andi-gcc at firstfloor dot org> --- Reducing the use of the function makes sense (I suspect it's not needed in many cases), but another option would be to allow moving it out of loops if it covers the whole loop body. The later would fix this test case too. This would need some special case code in the loop im optimizer though.