diff options
Diffstat (limited to 'lib/CodeGen')
-rw-r--r-- | lib/CodeGen/SelectionDAG/FastISel.cpp | 23 | ||||
-rw-r--r-- | lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp | 2 |
2 files changed, 9 insertions, 16 deletions
diff --git a/lib/CodeGen/SelectionDAG/FastISel.cpp b/lib/CodeGen/SelectionDAG/FastISel.cpp index fb4de574a8..1462472ea4 100644 --- a/lib/CodeGen/SelectionDAG/FastISel.cpp +++ b/lib/CodeGen/SelectionDAG/FastISel.cpp @@ -145,8 +145,6 @@ BasicBlock::iterator FastISel::SelectInstructions(BasicBlock::iterator Begin, BasicBlock::iterator End, DenseMap<const Value*, unsigned> &ValueMap, - std::map<const BasicBlock*, - MachineBasicBlock *> &MBBMap, MachineBasicBlock *mbb) { MBB = mbb; BasicBlock::iterator I = Begin; @@ -197,24 +195,19 @@ FastISel::SelectInstructions(BasicBlock::iterator Begin, case Instruction::Br: { BranchInst *BI = cast<BranchInst>(I); + // For now, check for and handle just the most trivial case: an + // unconditional fall-through branch. if (BI->isUnconditional()) { - MachineFunction::iterator NextMBB = + MachineFunction::iterator NextMBB = next(MachineFunction::iterator(MBB)); - BasicBlock *LLVMSucc = BI->getSuccessor(0); - MachineBasicBlock *MSucc = MBBMap[LLVMSucc]; - - if (NextMBB != MF.end() && MSucc == NextMBB) { - // The unconditional fall-through case, which needs no instructions. - } else { - // The unconditional branch case. - TII.InsertBranch(*MBB, MSucc, NULL, SmallVector<MachineOperand, 0>()); + if (NextMBB != MF.end() && + NextMBB->getBasicBlock() == BI->getSuccessor(0)) { + MBB->addSuccessor(NextMBB); + break; } - MBB->addSuccessor(MSucc); - break; } - // Conditional branches are not handed yet. - // Halt "fast" selection and bail. + // Something more complicated. Halt "fast" selection and bail. return I; } diff --git a/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp b/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp index e13cfc0fa0..9304c0e7a1 100644 --- a/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp +++ b/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp @@ -5113,7 +5113,7 @@ void SelectionDAGISel::BuildSelectionDAG(SelectionDAG &DAG, BasicBlock *LLVMBB, cast<BranchInst>(LLVMBB->getTerminator())->isUnconditional()) { if (FastISel *F = TLI.createFastISel(FuncInfo.MF)) { Begin = F->SelectInstructions(Begin, LLVMBB->end(), - FuncInfo.ValueMap, FuncInfo.MBBMap, BB); + FuncInfo.ValueMap, BB); // Clean up the FastISel object. TODO: Reorganize what data is // stored in the FastISel class itself and what is merely passed |