Mehdi Amini 2a6a62ac33
[MLIR] Fix out-of-bounds crash in matchReduction for ops with fewer yield operands (#183555)
`mlir::matchReduction()` accessed `terminatorOp->getOperand(redPos)`
without checking that `redPos` is within the terminator's operand count.
This caused an assertion failure when the region's block-argument count
exceeds the terminator's yield count, e.g. for `linalg.pooling_nhwc_sum`
whose kernel region has three block args but yields only one value.

Add a bounds check before the operand access so the function returns
nullptr gracefully instead of crashing.

Fixes #131437
2026-02-26 17:50:53 +01:00
..