https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85434
Wilco <wilco at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |wilco at gcc dot gnu.org --- Comment #4 from Wilco <wilco at gcc dot gnu.org> --- Clearly rematerialization isn't working correctly. Immediates and constant addresses like this should never be spilled (using MOV/MOVK could increase codesize, but with -Os you should use the literal pool anyway). Check legitimate_constant_p returns true, see https://gcc.gnu.org/ml/gcc-patches/2017-08/msg00052.html for how it's done on AArch64.