http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57540
--- Comment #3 from bin.cheng <amker.cheng at gmail dot com> --- I think this should be handled in expand. During expanding, GCC tries "base + scaled_offset + offset" pattern, which is invalid for targets like arm. At this point we still have a chance to refactor "base + offset" and force it into register, thus generating "reg + scaled_offset". By doing this, 1) "base + offset" can be kept as loop invariant; 2) the multiplication is done by scaled address, saving another add instruction. I am testing a patch and will send it for review once it passes tests.