Developer Guide and Reference


GAP Message (Diagnostic ID 30755)


Reordering the fields of the structure '%s' will improve data locality. Suggested field order: '%s'.


You should reorder the fields of the class or structure type in the specified order. This should improve performance by better utilizing the processor cache.
You must verify that the application code does not rely on the structure fields to be laid out in a specific order. For example, if the application code uses the address of a field to access other fields, it may stop working once the field reordering is applied. Note also that such code is not considered valid.
Consider the following:
//field_reord.c struct str { int a1, b1, carr[100], c1, d1, e1; };   extern struct str sp[];   int hot_func1() { int i, ret = 0;   for (i = 0; i < 1000000; i++) { ret += sp[i].a1; ret += sp[i].c1; } return ret; }   int hot_func2() { int ret = 0, i; for (i = 0; i < 100000; i++) { ret += sp[i].a1; ret -= sp[i].e1; } return ret; }   int hot_func3() { int ret = 0, i; for (i = 0; i < 1000000; i++) { ret += sp[i].carr[10]; } return ret + sp[0].b1 + sp[0].d1; }
In this case, when the program is compiled, the compiler generates a message saying that reordering the fields of the structure 'str' will improve data locality and that the suggested field order is 'a1, c1, e1, carr, b1, d1'.
For the above example, the only changes in
to reorder fields of the structure 'str' as advised are the following:
//field_reord.c struct str { int a1, c1, e1, carr[100], b1, d1; }; ...


The suggestion is based on the field references in the current compilation. Please make sure that the restructured code satisfies the original program semantics.

Product and Performance Information


Intel's compilers may or may not optimize to the same degree for non-Intel microprocessors for optimizations that are not unique to Intel microprocessors. These optimizations include SSE2, SSE3, and SSSE3 instruction sets and other optimizations. Intel does not guarantee the availability, functionality, or effectiveness of any optimization on microprocessors not manufactured by Intel. Microprocessor-dependent optimizations in this product are intended for use with Intel microprocessors. Certain optimizations not specific to Intel microarchitecture are reserved for Intel microprocessors. Please refer to the applicable product User and Reference Guides for more information regarding the specific instruction sets covered by this notice.

Notice revision #20110804