A moment ago, I realized that ImmBranches is already correctly updated after the new conditional branch is added.
The code is as follows:
// Insert a new conditional branch and a new unconditional branch.
// Also update the ImmBranch as well as adding a new entry for the new branch.
BuildMI(MBB, DebugLoc(), TII->get(MI->getOpcode()))
Br.MI = &MBB->back();
BBInfo[MBB->getNumber()].Size += TII->getInstSizeInBytes(MBB->back());
Althrough the original conditional branch is removed, the corresponding ImmBranch object remains in ImmBranches.
After the new conditional branch is added, the ImmBranch object of the original conditional branch is updated to associate with the new conditional branch. Since the conditional branches have the same opcode, other members of the ImmBranch object, including MaxDisp, isCond and UncondBr, are already correct and do not need updating. Therefore, the ImmBranch object is correct for the new conditional branch, and the new conditional branch will be seen during subsequent iterations.
I am sorry for the false alarm.