1. A method for executing instructions in a vector processor, comprising: while fetching instructions from program code in the processor, repeatedly: starting from an initial instruction in a loop in the program code, fetching instructions from the loop; and upon fetching a branch instruction from the loop that, when taken, causes the processor to branch back to the initial instruction, incrementing a branch instruction counter and predicting the branch instruction as taken, causing the processor to return to the initial instruction and continue fetching instructions from the loop; while fetching the instructions from the loop, calculating a number of times that the branch instruction will actually be taken when the fetched instructions are executed, wherein calculating the number of times that the branch instruction will actually be taken comprises receiving a dependency index vector (DIV) for the loop in the program code, the DIV indicating dependencies between iterations for the loop of program code, and executing a SegCount instruction with the DIV as an input, wherein an output of the SegCount instruction indicates number of times that the branch instruction will actually be taken; and upon determining that the branch instruction counter is greater than the number of times that the branch instruction will actually be taken, immediately commencing a mispredict operation for the branch instruction, which comprises: flushing fetched instructions from the loop that will not be executed from the processor; and commencing fetching instructions from an instruction following the branch instruction.