Operate on the Machine CFG instead of on the LLVM CFG


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@13302 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/CodeGen/PHIElimination.cpp b/lib/CodeGen/PHIElimination.cpp
index 324f4c4..180cb6d 100644
--- a/lib/CodeGen/PHIElimination.cpp
+++ b/lib/CodeGen/PHIElimination.cpp
@@ -20,7 +20,6 @@
 #include "llvm/CodeGen/LiveVariables.h"
 #include "llvm/Target/TargetInstrInfo.h"
 #include "llvm/Target/TargetMachine.h"
-#include "llvm/Support/CFG.h"
 #include "Support/STLExtras.h"
 using namespace llvm;
 
@@ -195,14 +194,12 @@
           // at an appropriate point later.
           //
           bool ValueIsLive = false;
-          const BasicBlock *BB = opBlock.getBasicBlock();
-          for (succ_const_iterator SI = succ_begin(BB), E = succ_end(BB);
-               SI != E && !ValueIsLive; ++SI) {
-            const std::pair<MachineBasicBlock*, unsigned> &
-              SuccInfo = LV->getBasicBlockInfo(*SI);
+          for (MachineBasicBlock::succ_iterator SI = opBlock.succ_begin(),
+                 E = opBlock.succ_end(); SI != E && !ValueIsLive; ++SI) {
+            MachineBasicBlock *MBB = *SI;
             
             // Is it alive in this successor?
-            unsigned SuccIdx = SuccInfo.second;
+            unsigned SuccIdx = LV->getMachineBasicBlockIndex(MBB);
             if (SuccIdx < InRegVI.AliveBlocks.size() &&
                 InRegVI.AliveBlocks[SuccIdx]) {
               ValueIsLive = true;
@@ -210,7 +207,6 @@
             }
             
             // Is it killed in this successor?
-            MachineBasicBlock *MBB = SuccInfo.first;
             for (unsigned i = 0, e = InRegVI.Kills.size(); i != e; ++i)
               if (InRegVI.Kills[i].first == MBB) {
                 ValueIsLive = true;