match.pd: Restrict range test to scalars [PR127379]
Fixes a bug where vector types were incorrectly processed by a scalar range test, preventing potential regressions.
A pattern in match.pd used for range tests, X | -X, was incorrectly applied to vector types. This led to a scalar comparison being converted to a vector type, potentially causing issues. The fix restricts this pattern to integral types, aligning with other scalar-only matchers and preventing regressions. A new test case has been added to verify the fix.
In Details
The ior_range_test_0 pattern in match.pd previously lacked a constant operand check, allowing vector types to reach it. The X | -X expression, when applied to vectors, resulted in a scalar comparison being promoted to a vector type. This commit restricts the pattern to INTEGER_CST operands, mirroring other scalar-focused matchers in the range-test patterns and addressing PR127379.
- match.pd
- A file within GCC that defines patterns used for instruction matching and optimization.
- scalar
- A data type representing a single value, as opposed to an array or structure.
- vector type
- A data type that holds multiple values of the same base type, typically processed in parallel by a single instruction.