i386: Fix Peephole2s With const359_operand
Fixes an ICE on i386 by ensuring peephole optimizations for multiplications avoid using the stack pointer as an index register.
This commit fixes an internal compiler error (ICE) on i386. The const359_operand peephole optimization was incorrectly attempting to transform multiplications of the stack pointer (%rsp) by 3, 5, or 9 into a lea instruction, which is invalid because the stack pointer cannot be used as an index register. The fix ensures that the optimization uses index_reg_operand to prevent the stack pointer from being used as an index register.
In Details
This commit fixes PR125373 by using index_reg_operand instead of register_operand in the Convert imul by three, five and nine into lea define_peephole2s pattern in config/i386/i386.md. This prevents the peephole from incorrectly matching when the register is the stack pointer, avoiding an ICE. This is relevant to x86 backend maintainers.
For Context
Compilers use peephole optimizations to improve code by replacing short sequences of instructions with more efficient ones. This commit fixes a bug in the i386 code generator where a peephole optimization was incorrectly trying to use the stack pointer in a way that's not allowed by the architecture. This could cause the compiler to crash during compilation. The fix ensures the compiler generates valid code.