https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64616
--- Comment #2 from thopre01 at gcc dot gnu.org ---
For arm-none-linux-gnueabihf-gcc configured with --with-arch=armv7-a and
compiling without any -mcpu (so default cpu) the problem is also there:
stmfd sp!, {r4, r5, r6, lr}
movw r5, #:lower16:glob
movt r5, #:upper16:glob
.L2:
ldr r0, [r5]
movw r4, #:lower16:glob
bl g
movt r4, #:upper16:glob
cmp r0, #0
bne .L2
mov r3, #1
str r3, [r4]
ldmfd sp!, {r4, r5, r6, pc}
This is due to pre introducing a new pseudoregister to load the address of glob
and cprop propagating it only locally in the same basic block but not globally
into the store.