Index: lib/CodeGen/BranchRelaxation.cpp =================================================================== --- lib/CodeGen/BranchRelaxation.cpp +++ lib/CodeGen/BranchRelaxation.cpp @@ -116,6 +116,7 @@ unsigned Num = MBB.getNumber(); assert(BlockInfo[Num].Offset % (1u << Align) == 0); assert(!Num || BlockInfo[PrevNum].postOffset(MBB) <= BlockInfo[Num].Offset); + assert(BlockInfo[Num].Size == computeBlockSize(MBB)); PrevNum = Num; } #endif @@ -385,12 +386,9 @@ DebugLoc DL = MI.getDebugLoc(); MI.eraseFromParent(); - - // insertUnconditonalBranch may have inserted a new block. - BlockInfo[MBB->getNumber()].Size += TII->insertIndirectBranch( + BlockInfo[BranchBB->getNumber()].Size += TII->insertIndirectBranch( *BranchBB, *DestBB, DL, DestOffset - SrcOffset, RS.get()); - computeBlockSize(*BranchBB); adjustBlockOffsets(*MBB); return true; }