Enable live lane extraction costing for loop vectorization
Improves loop vectorization by accurately costing lane extraction operations.
This change enables the cost model to account for ‘live lane extraction’ operations, which are part of vectorization. It ensures that these costs are consistently applied whether vectorization occurs within the main loop body or in a loop epilog, leading to more accurate cost estimations and potentially better vectorization decisions.
In Details
The loop vectorizer's cost model in tree-vect-loop.cc now accounts for the cost of live lane extraction. Previously, this cost was not consistently applied, particularly for basic-block (BB) vectorization within vect_body. This commit updates vectorizable_live_operation to apply the cost for BB vectorization in vect_body and for loop vectorization in vect_epilog, ensuring a unified costing approach.
- loop vectorization
- An optimization technique that transforms a loop to operate on multiple data elements simultaneously using wide vector registers, significantly improving performance for data-parallel computations.
- live lane extraction
- A specific operation during vectorization where data from a vector register is selectively extracted to form a scalar value or to be used in a subsequent operation. This often occurs when a loop's body can only be partially vectorized.
- costing
- In compiler optimization, costing refers to the process of estimating the performance impact (e.g., execution time, instruction count) of various operations or code transformations. This guides the optimizer's choices.
- vect_body
- Refers to the main part of the loop body that is being considered for vectorization.
- vect_epilog
- The part of the loop that handles remaining iterations after the main vectorized loop has completed. This is often needed when the number of iterations is not a multiple of the vector width.