1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-19 11:02:59 +02:00

LiveInterval: A LiveRange is enough for ConnectedVNInfoEqClasses::Classify()

llvm-svn: 257129
This commit is contained in:
Matthias Braun 2016-01-08 01:16:35 +00:00
parent 96a9f5305c
commit 36dbef6f05
4 changed files with 10 additions and 10 deletions

View File

@ -848,9 +848,9 @@ namespace llvm {
public: public:
explicit ConnectedVNInfoEqClasses(LiveIntervals &lis) : LIS(lis) {} explicit ConnectedVNInfoEqClasses(LiveIntervals &lis) : LIS(lis) {}
/// Classify - Classify the values in LI into connected components. /// Classify the values in LI into connected components.
/// Return the number of connected components. /// Returns the number of connected components.
unsigned Classify(const LiveInterval *LI); unsigned Classify(const LiveRange &LR);
/// getEqClass - Classify creates equivalence classes numbered 0..N. Return /// getEqClass - Classify creates equivalence classes numbered 0..N. Return
/// the equivalence class assigned the VNI. /// the equivalence class assigned the VNI.

View File

@ -1328,15 +1328,15 @@ void LiveRangeUpdater::flush() {
LR->verify(); LR->verify();
} }
unsigned ConnectedVNInfoEqClasses::Classify(const LiveInterval *LI) { unsigned ConnectedVNInfoEqClasses::Classify(const LiveRange &LR) {
// Create initial equivalence classes. // Create initial equivalence classes.
EqClass.clear(); EqClass.clear();
EqClass.grow(LI->getNumValNums()); EqClass.grow(LR.getNumValNums());
const VNInfo *used = nullptr, *unused = nullptr; const VNInfo *used = nullptr, *unused = nullptr;
// Determine connections. // Determine connections.
for (const VNInfo *VNI : LI->valnos) { for (const VNInfo *VNI : LR.valnos) {
// Group all unused values into one class. // Group all unused values into one class.
if (VNI->isUnused()) { if (VNI->isUnused()) {
if (unused) if (unused)
@ -1351,14 +1351,14 @@ unsigned ConnectedVNInfoEqClasses::Classify(const LiveInterval *LI) {
// Connect to values live out of predecessors. // Connect to values live out of predecessors.
for (MachineBasicBlock::const_pred_iterator PI = MBB->pred_begin(), for (MachineBasicBlock::const_pred_iterator PI = MBB->pred_begin(),
PE = MBB->pred_end(); PI != PE; ++PI) PE = MBB->pred_end(); PI != PE; ++PI)
if (const VNInfo *PVNI = LI->getVNInfoBefore(LIS.getMBBEndIdx(*PI))) if (const VNInfo *PVNI = LR.getVNInfoBefore(LIS.getMBBEndIdx(*PI)))
EqClass.join(VNI->id, PVNI->id); EqClass.join(VNI->id, PVNI->id);
} else { } else {
// Normal value defined by an instruction. Check for two-addr redef. // Normal value defined by an instruction. Check for two-addr redef.
// FIXME: This could be coincidental. Should we really check for a tied // FIXME: This could be coincidental. Should we really check for a tied
// operand constraint? // operand constraint?
// Note that VNI->def may be a use slot for an early clobber def. // Note that VNI->def may be a use slot for an early clobber def.
if (const VNInfo *UVNI = LI->getVNInfoBefore(VNI->def)) if (const VNInfo *UVNI = LR.getVNInfoBefore(VNI->def))
EqClass.join(VNI->id, UVNI->id); EqClass.join(VNI->id, UVNI->id);
} }
} }

View File

@ -1446,7 +1446,7 @@ void LiveIntervals::removeVRegDefAt(LiveInterval &LI, SlotIndex Pos) {
void LiveIntervals::splitSeparateComponents(LiveInterval &LI, void LiveIntervals::splitSeparateComponents(LiveInterval &LI,
SmallVectorImpl<LiveInterval*> &SplitLIs) { SmallVectorImpl<LiveInterval*> &SplitLIs) {
ConnectedVNInfoEqClasses ConEQ(*this); ConnectedVNInfoEqClasses ConEQ(*this);
unsigned NumComp = ConEQ.Classify(&LI); unsigned NumComp = ConEQ.Classify(LI);
if (NumComp <= 1) if (NumComp <= 1)
return; return;
DEBUG(dbgs() << " Split " << NumComp << " components: " << LI << '\n'); DEBUG(dbgs() << " Split " << NumComp << " components: " << LI << '\n');

View File

@ -1736,7 +1736,7 @@ void MachineVerifier::verifyLiveInterval(const LiveInterval &LI) {
// Check the LI only has one connected component. // Check the LI only has one connected component.
ConnectedVNInfoEqClasses ConEQ(*LiveInts); ConnectedVNInfoEqClasses ConEQ(*LiveInts);
unsigned NumComp = ConEQ.Classify(&LI); unsigned NumComp = ConEQ.Classify(LI);
if (NumComp > 1) { if (NumComp > 1) {
report("Multiple connected components in live interval", MF); report("Multiple connected components in live interval", MF);
report_context(LI); report_context(LI);