IR: Fix an inverted assertion when replacing resolved operands