ipa_rescopes_globals

Rescopes the application global variables, that are only used in one function, to local static. The change to static enables other optimizations that improve alias analysis and load/store optimizations.

Syntax
  #pragma ipa_rescopes_globals on | off | reset

  
Remarks

Ensure that the following requirements are met to rescope the application global variables to local static:

However, it is important to have as many of your application sources as possible compiled with those options enabled.

Note: As the third party libraries generally do not access the application variables, these libraries can be kept in archive form.

For a simple example, compile/assemble your startup code without program IPA. Compile all of the application code with program IPA, #pragma ipa_rescopes_globals on and link the startup objects, your application objects and the library archives. For more details on Program IPA linking procedures, refer Interprocedural Analysis.

For a complex example where the application sources are put into groups, compiled and then pre-built into several archives or partially linked objects and the build procedure cannot be matched with the simple example, following changes to the build procedure are suggested:

Generatingasuccessfullink

Optimization prevents an improper build. If you do not get a successful link or you only get a few such link errors, identify the source file that defines the "undefined" symbol and try one of the following (in decreasing order of general preference):