https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69042
--- Comment #5 from amker at gcc dot gnu.org --- (In reply to Andrew Pinski from comment #1) > Confirmed, even on aarch64 too. Replacing the asm with: > > asm("":::"x0","x1","x2","x3","x4","x5","x6","x7","x8","x9","x10","x11","x12", > "x13","x14","x15","x16","x17","x18","x19","x20","x21","x22","x23","x24", > "x25","x26","x27","x28","x30"); > > > Shows the problem there. AArch64 case is complicated. 1) TREE/IVOPT doesn't understand asm instruction and its register pressure. 2) cost computation with symbol_ref involved is a mess because of both IVOPT and AArch64 backend. 3) Same as x86_64, IVOPT doesn't count register pressure for symbol value in memory reference. ... And most important: 4) If IVOPT picks up candidate {*index, 4}, it does decrease register pressure by one at the point of array reference, but this is neutralized because at exit condition of the loop, we need one more register to hold the terminating value. For now it's a constant 64 and can be rematerialized in cmp instruction. I think there is no benefit on AArch64 wrto this example.