https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109393

--- Comment #18 from cuilili <lili.cui at intel dot com> ---
I agree with your first point: from the perspective of “canonical GIMPLE form,”
this transformation is correct.

For the x86 backend, my initial approach was to handle PLUS(base,
MULT(PLUS(reg, const), scale)) and MULT(PLUS(reg, const), scale) in
ix86_decompose_address (which is called by ix86_legitimate_address_p). With
this patch, we can generate more SIB addressing forms.

However, in more complex cases, the intermediate variables introduced by this
transformation tend to have many uses across the code, leading to long
dependency chains. At the backend level, it is not feasible to transform all
uses back into a distributed form. As a result, these intermediate variables
cannot be eliminated and many of them remain live simultaneously. This
significantly increases register pressure in IRA and leads to a large number of
spills.

Additionally, during the reload pass, many of these variables are identified as
having inheritance relationships. Since related variables tend to prefer the
same register, this can cause spilling to become concentrated on specific
registers, further degrading performance.

I may continue exploring opportunities for optimization in the reload process.

Reply via email to