Vectorizer conservatively estimates loop iterations for assumptions.
The vectorizer's cost model now uses the number of statements in an assumption tree, not just one, for iteration estimates.
The vectorizer’s cost model has been updated to more conservatively estimate the number of loop iterations required for assumptions. Instead of considering only a single vector statement, it now accounts for all statements involved in the assumption tree. This change aims to improve the accuracy of profitability analysis for vectorization.
In Details
This commit adjusts the vect_estimate_min_profitable_iters function in tree-vect-loop.cc to use a more conservative cost for the niter-assumption. Previously, it likely considered a single statement's cost. Now, it conservatively uses the total number of statements involved in the assumption tree, providing a more robust baseline for deciding whether to vectorize based on iteration count assumptions.
- Vectorizer
- A compiler component that automatically transforms loops to perform the same computations on multiple data elements simultaneously, often using SIMD (Single Instruction, Multiple Data) instructions for performance gains.
- cost model
- Part of the compiler's optimization logic that estimates the performance impact (cost) of different transformations or code sequences to guide the selection of the most efficient options.
- assumption tree
- In the context of loop analysis, this likely refers to a tree-like structure representing various assumptions made about loop behavior, such as bounds, independence of iterations, or data dependencies.
- niter-assumption
- An assumption made by the compiler about the number of iterations a loop will perform, often used to guide optimization decisions like vectorization.