Files
opencv/modules
pranayr710 78ed76f0d9 core: keep named texpr values alive across slot-retiring optimizations
TExpr::moveToOutput() and the abs(x - y) -> absdiff(x, y) peephole in
TExpr::emitUnary() retire a value's arg slot (reclassify it to NONE) once
its single consumer has been emitted. That holds for an anonymous
intermediate, but a value the parser bound to a name ("t = ...;") may be
referenced again: the parser's name table still points at the retired slot,
so the later reference resolved to the reserved empty operand and
cv::texpr() silently returned a wrong result - for

    t = {0} - {1}; abs(t) + t
    t = {0} - {1}; (abs(t), t)
    t = {0} + {1}; (t, t)

the reused name yielded input {0} instead of its own value, with no
assertion.

Mark a slot as pinned when the parser binds it to a name and skip both
retire manoeuvres for a pinned slot; each then takes the non-destructive
path it already has - moveToOutput() copies into the output via OP_CAST,
and the abs peephole falls through to the plain absdiff(a, 0) form, keeping
the OP_SUB that the name still needs. Anonymous intermediates are
unaffected, so the zero-temp fast path for single-op programs still fires.
2026-09-13 02:30:55 +05:30
..
2026-09-08 13:39:45 +02:00
2026-07-09 12:17:24 +03:00
2026-07-09 12:17:24 +03:00
2026-08-19 17:38:39 +02:00