SelectionDAGBuilder::handleJTSwitchCase, simplify loop; NFC

llvm-svn: 232830
This commit is contained in:
Hans Wennborg 2015-03-20 18:48:31 +00:00
parent ecf380ef3b
commit 2bdc4cf35f
1 changed files with 4 additions and 9 deletions

View File

@ -2337,15 +2337,10 @@ bool SelectionDAGBuilder::handleJTSwitchCase(CaseRec &CR,
// Calculate weight for each unique destination in CR.
DenseMap<MachineBasicBlock*, uint32_t> DestWeights;
if (FuncInfo.BPI)
for (CaseItr I = CR.Range.first, E = CR.Range.second; I != E; ++I) {
DenseMap<MachineBasicBlock*, uint32_t>::iterator Itr =
DestWeights.find(I->BB);
if (Itr != DestWeights.end())
Itr->second += I->ExtraWeight;
else
DestWeights[I->BB] = I->ExtraWeight;
}
if (FuncInfo.BPI) {
for (CaseItr I = CR.Range.first, E = CR.Range.second; I != E; ++I)
DestWeights[I->BB] += I->ExtraWeight;
}
// Update successor info. Add one edge to each unique successor.
BitVector SuccsHandled(CR.CaseBB->getParent()->getNumBlockIDs());