This remark is part of the open catalog of best practice rules for performance that is automatically detected and reported by Codee.
Issue
Loop is not a SIMD opportunity because of the unpredictable memory accesses in the loop body
Relevance
Memory access pattern is very important for good software performance. The loop contains unpredictable memory accesses (either because of dereferencing a pointer or because it accesses array elements indirectly). This type of memory access pattern is very inefficient from the memory subsystem perspective, and these loops are typically not good SIMD opportunities.
Occasionally, loops with unpredictable memory access pattern can benefit from vectorization: if the loop is computationally expensive, using loop fission to isolate the unpredictable accesses to a separate loop can help vectorize the remaining part of the loop. Alternatively, if the dataset the loop is processing is really small, the loop can benefit from explicit vectorization using compiler pragmas. Another idea: if the loop in question is a part of a loop nest, performing loop interchange or loop tiling can decrease the pressure on the memory subsystem as well.
Actions
If you wish to vectorize the loop nonetheless, apply --ignore-cost-model
on the PWA command line and then use pwdirectives
to vectorize the loop.
Alternatively, you can perform loop fission to isolate the unpredictable memory accesses to a separate loop.
Related resources
PWR020: Consider loop fission to enable vectorization
PWR021: Consider loop fission with scalar to vector promotion to enable vectorization
PWR022: Move invariant conditional out of the loop to facilitate vectorization

Building performance into the code from day one with Codee