Match: Only enable `(A>>bool) EQ 0 -> (unsigned)A LE bool` for non-vector types.
The `(A>>bool) EQ 0 -> (unsigned)A <= bool` optimization pattern now only applies to non-vector integral types.
The (A>>bool) EQ 0 -> (unsigned)A <= bool optimization pattern was incorrectly applied to vector types. It now only triggers for non-vector integral types. This avoids generating incorrect code for vector types, as the transformation requires a vector duplicate of the boolean value.
In Details
GCC's match.pd defines peephole optimisations on GIMPLE IR. This commit restricts a particular transformation to non-vector types. The transformation involves bit shifting and comparison operations, and the fix ensures correct code generation for different data types.
For Context
Compilers often perform peephole optimizations to improve code efficiency by replacing small sequences of instructions with faster equivalents. These optimizations are defined using pattern matching rules, and this commit fixes an issue where a specific pattern was incorrectly applied to vector types, leading to incorrect code. The fix restricts the pattern to only apply to non-vector integral types, ensuring that the optimization is only performed when it is valid.