Fixes incorrect simplification of unsigned multiplication by one.
Corrects a bug in GCC's RTL optimization pass that misapplied a simplification for unsigned multiplication by one.
A bug in GCC’s RTL optimization pass (specifically in simplify_binary_operation_1) has been fixed. The side_effects_p flag was incorrectly set for unsigned multiplication by one, leading to erroneous code generation. This change corrects the flag to ensure proper simplification and adds a test case to prevent regressions.
In Details
The simplify_binary_operation_1 function in simplify-rtx.cc incorrectly set side_effects_p to true for UMUL_HIGHPART when the second operand was x h* 1. This commit corrects the side_effects_p argument for this specific case to 0 (false), resolving PR128119. A new test case gcc.target/i386/pr128119.c has been added.
- RTL
- Register Transfer Language, an intermediate representation used internally by GCC. It describes operations on virtual registers and is optimized before code generation.
- side_effects_p
- A predicate used in GCC's RTL optimizers to indicate whether an operation might have side effects (e.g., modifying memory, raising exceptions). This helps the optimizer determine if an operation can be safely reordered or removed.
- UMUL_HIGHPART
- An RTL operation representing the higher-order bits of an unsigned multiplication result. Typically used in conjunction with a lower-order part to represent the full product of two large unsigned integers.
- PR128119
- Problem Report 128119, a bug filed against the GCC compiler. This identifier links the commit to a specific issue tracked in the GCC bug tracking system.