Hi The detailed description of the optimization is at http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43129. This is an ARM specific optimization.
This optimization uses one less register (the register hold the GOT base), to get this beneficial the ideal place for it should be before register allocation. Usually expand pass generates instructions to load global variable's address from GOT entry for each access of the global variable. Later cse/gcse passes can remove many of them. In order to precisely model the cost, this optimization should be put after some cse/gcse passes. So what is the best place for this optimization? Is there any existed pass can be enhanced with this optimization? Or should I add a new pass? thanks Guozhi