diff options
author | Evan Cheng <evan.cheng@apple.com> | 2009-09-19 09:51:03 +0000 |
---|---|---|
committer | Evan Cheng <evan.cheng@apple.com> | 2009-09-19 09:51:03 +0000 |
commit | ce31910eae5bd4896fa6c27798e7b26885691d3b (patch) | |
tree | 724f5ef9adebe214b0b564f1f8153e5d329e0a31 /lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp | |
parent | 83d63919bd990ce00f62e18114504b9e4a5cb35e (diff) |
Fix PR4926. When target hook EmitInstrWithCustomInserter() insert new basic blocks and update CFG, it should also inform sdisel of the changes so the phi source operands will come from the right basic blocks.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82311 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp')
-rw-r--r-- | lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp b/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp index 34e89dc22f..be04740317 100644 --- a/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp +++ b/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp @@ -954,14 +954,15 @@ SelectionDAGISel::FinishBasicBlock() { "This is not a machine PHI node that we are updating!"); // "default" BB. We can go there only from header BB. if (PHIBB == SDL->JTCases[i].second.Default) { - PHI->addOperand(MachineOperand::CreateReg(SDL->PHINodesToUpdate[pi].second, - false)); - PHI->addOperand(MachineOperand::CreateMBB(SDL->JTCases[i].first.HeaderBB)); + PHI->addOperand + (MachineOperand::CreateReg(SDL->PHINodesToUpdate[pi].second, false)); + PHI->addOperand + (MachineOperand::CreateMBB(SDL->JTCases[i].first.HeaderBB)); } // JT BB. Just iterate over successors here if (BB->succ_end() != std::find(BB->succ_begin(),BB->succ_end(), PHIBB)) { - PHI->addOperand(MachineOperand::CreateReg(SDL->PHINodesToUpdate[pi].second, - false)); + PHI->addOperand + (MachineOperand::CreateReg(SDL->PHINodesToUpdate[pi].second, false)); PHI->addOperand(MachineOperand::CreateMBB(BB)); } } @@ -999,7 +1000,8 @@ SelectionDAGISel::FinishBasicBlock() { // handle them the right number of times. while ((BB = SDL->SwitchCases[i].TrueBB)) { // Handle LHS and RHS. // If new BB's are created during scheduling, the edges may have been - // updated. + // updated. That is, the edge from ThisBB to BB may have been split and + // BB's predecessor is now another block. DenseMap<MachineBasicBlock*, MachineBasicBlock*>::iterator EI = SDL->EdgeMapping.find(BB); if (EI != SDL->EdgeMapping.end()) |