Add simple loop detection via the instruction counter.