diff options
author | Jakob Stoklund Olesen <stoklund@2pi.dk> | 2010-08-12 20:38:03 +0000 |
---|---|---|
committer | Jakob Stoklund Olesen <stoklund@2pi.dk> | 2010-08-12 20:38:03 +0000 |
commit | 0910689353172d68f16293c35e9afdfcdd9cc506 (patch) | |
tree | fe433bb8fa033e4255d05094c9a069e1412967eb | |
parent | 44a320dafa3b52783ede624132c077304be0ed7e (diff) | |
download | bcm5719-llvm-0910689353172d68f16293c35e9afdfcdd9cc506.tar.gz bcm5719-llvm-0910689353172d68f16293c35e9afdfcdd9cc506.zip |
Also recompute HasPHIKill flags in LiveInterval::RenumberValues.
If a phi-def value were removed from the interval, the phi-kill flags are no
longer valid.
llvm-svn: 110949
-rw-r--r-- | llvm/include/llvm/CodeGen/LiveInterval.h | 3 | ||||
-rw-r--r-- | llvm/lib/CodeGen/LiveInterval.cpp | 23 | ||||
-rw-r--r-- | llvm/lib/CodeGen/SplitKit.cpp | 2 |
3 files changed, 25 insertions, 3 deletions
diff --git a/llvm/include/llvm/CodeGen/LiveInterval.h b/llvm/include/llvm/CodeGen/LiveInterval.h index ff1dbc27752..29e689a5214 100644 --- a/llvm/include/llvm/CodeGen/LiveInterval.h +++ b/llvm/include/llvm/CodeGen/LiveInterval.h @@ -338,7 +338,8 @@ namespace llvm { /// RenumberValues - Renumber all values in order of appearance and remove /// unused values. - void RenumberValues(); + /// Recalculate phi-kill flags in case any phi-def values were removed. + void RenumberValues(LiveIntervals &lis); /// isOnlyLROfValNo - Return true if the specified live range is the only /// one defined by the its val#. diff --git a/llvm/lib/CodeGen/LiveInterval.cpp b/llvm/lib/CodeGen/LiveInterval.cpp index 9a853e8eafa..59f380ad264 100644 --- a/llvm/lib/CodeGen/LiveInterval.cpp +++ b/llvm/lib/CodeGen/LiveInterval.cpp @@ -182,8 +182,9 @@ void LiveInterval::markValNoForDeletion(VNInfo *ValNo) { /// RenumberValues - Renumber all values in order of appearance and delete the /// remaining unused values. -void LiveInterval::RenumberValues() { +void LiveInterval::RenumberValues(LiveIntervals &lis) { SmallPtrSet<VNInfo*, 8> Seen; + bool seenPHIDef = false; valnos.clear(); for (const_iterator I = begin(), E = end(); I != E; ++I) { VNInfo *VNI = I->valno; @@ -192,6 +193,26 @@ void LiveInterval::RenumberValues() { assert(!VNI->isUnused() && "Unused valno used by live range"); VNI->id = (unsigned)valnos.size(); valnos.push_back(VNI); + VNI->setHasPHIKill(false); + if (VNI->isPHIDef()) + seenPHIDef = true; + } + + // Recompute phi kill flags. + if (!seenPHIDef) + return; + for (const_vni_iterator I = vni_begin(), E = vni_end(); I != E; ++I) { + VNInfo *VNI = *I; + if (!VNI->isPHIDef()) + continue; + const MachineBasicBlock *PHIBB = lis.getMBBFromIndex(VNI->def); + assert(PHIBB && "No basic block for phi-def"); + for (MachineBasicBlock::const_pred_iterator PI = PHIBB->pred_begin(), + PE = PHIBB->pred_end(); PI != PE; ++PI) { + VNInfo *KVNI = getVNInfoAt(lis.getMBBEndIdx(*PI).getPrevSlot()); + if (KVNI) + KVNI->setHasPHIKill(true); + } } } diff --git a/llvm/lib/CodeGen/SplitKit.cpp b/llvm/lib/CodeGen/SplitKit.cpp index af658738073..a45e7bf3eb8 100644 --- a/llvm/lib/CodeGen/SplitKit.cpp +++ b/llvm/lib/CodeGen/SplitKit.cpp @@ -645,7 +645,7 @@ void SplitEditor::rewrite() { // dupli_ goes in last, after rewriting. if (dupli_) { - dupli_->RenumberValues(); + dupli_->RenumberValues(lis_); intervals_.push_back(dupli_); } |