Give a better assertion if we see a use before a def.
[oota-llvm.git] / lib / CodeGen / LiveVariables.cpp
index b6d9bc2a6015ff7987f5ab6eb27fc366a0443fa6..630477d7b654cae1d87264ffc166e6ea84a90020 100644 (file)
@@ -82,6 +82,8 @@ void LiveVariables::MarkVirtRegAliveInBlock(VarInfo &VRInfo,
 
 void LiveVariables::HandleVirtRegUse(VarInfo &VRInfo, MachineBasicBlock *MBB,
                                      MachineInstr *MI) {
+  assert(VRInfo.DefInst && "Register use before def!");
+
   // Check to see if this basic block is already a kill block...
   if (!VRInfo.Kills.empty() && VRInfo.Kills.back()->getParent() == MBB) {
     // Yes, this register is killed in this basic block already.  Increase the
@@ -102,7 +104,6 @@ void LiveVariables::HandleVirtRegUse(VarInfo &VRInfo, MachineBasicBlock *MBB,
   VRInfo.Kills.push_back(MI);
 
   // Update all dominating blocks to mark them known live.
-  const BasicBlock *BB = MBB->getBasicBlock();
   for (MachineBasicBlock::const_pred_iterator PI = MBB->pred_begin(),
          E = MBB->pred_end(); PI != E; ++PI)
     MarkVirtRegAliveInBlock(VRInfo, *PI);