From: Jakob Stoklund Olesen Date: Thu, 3 Feb 2011 20:29:39 +0000 (+0000) Subject: Add debug output and asserts to the phi-connecting code. X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=c50f077b065a328a7ce21d97cfc0a21e5059f735;p=oota-llvm.git Add debug output and asserts to the phi-connecting code. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@124813 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/CodeGen/SplitKit.cpp b/lib/CodeGen/SplitKit.cpp index 8bd62800e02..3ffb079acd3 100644 --- a/lib/CodeGen/SplitKit.cpp +++ b/lib/CodeGen/SplitKit.cpp @@ -978,16 +978,27 @@ void SplitEditor::finish() { const VNInfo *PHIVNI = *I; if (!PHIVNI->isPHIDef()) continue; - LiveIntervalMap &LIM = LIMappers[RegAssign.lookup(PHIVNI->def)]; + unsigned RegIdx = RegAssign.lookup(PHIVNI->def); + LiveIntervalMap &LIM = LIMappers[RegIdx]; MachineBasicBlock *MBB = LIS.getMBBFromIndex(PHIVNI->def); + DEBUG(dbgs() << " map phi in BB#" << MBB->getNumber() << '@' << PHIVNI->def + << " -> " << RegIdx << '\n'); for (MachineBasicBlock::pred_iterator PI = MBB->pred_begin(), PE = MBB->pred_end(); PI != PE; ++PI) { SlotIndex End = LIS.getMBBEndIdx(*PI).getPrevSlot(); + DEBUG(dbgs() << " pred BB#" << (*PI)->getNumber() << '@' << End); // The predecessor may not have a live-out value. That is OK, like an // undef PHI operand. - if (VNInfo *VNI = Edit.getParent().getVNInfoAt(End)) + if (VNInfo *VNI = Edit.getParent().getVNInfoAt(End)) { + DEBUG(dbgs() << " has parent valno #" << VNI->id << " live out\n"); + assert(RegAssign.lookup(End) == RegIdx && + "Different register assignment in phi predecessor"); LIM.mapValue(VNI, End); + } + else + DEBUG(dbgs() << " is not live-out\n"); } + DEBUG(dbgs() << " " << *LIM.getLI() << '\n'); } // Rewrite instructions.