diff options
Diffstat (limited to 'llvm/lib/CodeGen')
| -rw-r--r-- | llvm/lib/CodeGen/MachineFunction.cpp | 27 | 
1 files changed, 19 insertions, 8 deletions
diff --git a/llvm/lib/CodeGen/MachineFunction.cpp b/llvm/lib/CodeGen/MachineFunction.cpp index e125638d3a3..3df88fca437 100644 --- a/llvm/lib/CodeGen/MachineFunction.cpp +++ b/llvm/lib/CodeGen/MachineFunction.cpp @@ -545,14 +545,25 @@ MachineJumpTableInfo::ReplaceMBBInJumpTables(MachineBasicBlock *Old,                                               MachineBasicBlock *New) {    assert(Old != New && "Not making a change?");    bool MadeChange = false; -  for (size_t i = 0, e = JumpTables.size(); i != e; ++i) { -    MachineJumpTableEntry &JTE = JumpTables[i]; -    for (size_t j = 0, e = JTE.MBBs.size(); j != e; ++j) -      if (JTE.MBBs[j] == Old) { -        JTE.MBBs[j] = New; -        MadeChange = true; -      } -  } +  for (size_t i = 0, e = JumpTables.size(); i != e; ++i) +    ReplaceMBBInJumpTable(i, Old, New); +  return MadeChange; +} + +/// ReplaceMBBInJumpTable - If Old is a target of the jump tables, update +/// the jump table to branch to New instead. +bool +MachineJumpTableInfo::ReplaceMBBInJumpTable(unsigned Idx, +                                            MachineBasicBlock *Old, +                                            MachineBasicBlock *New) { +  assert(Old != New && "Not making a change?"); +  bool MadeChange = false; +  MachineJumpTableEntry &JTE = JumpTables[Idx]; +  for (size_t j = 0, e = JTE.MBBs.size(); j != e; ++j) +    if (JTE.MBBs[j] == Old) { +      JTE.MBBs[j] = New; +      MadeChange = true; +    }    return MadeChange;  }  | 

