[llvm-commits] [llvm] r139612 - in /llvm/trunk/lib/CodeGen: SplitKit.cpp SplitKit.h

Jakob Stoklund Olesen stoklund at 2pi.dk
Tue Sep 13 11:05:29 PDT 2011


Author: stoklund
Date: Tue Sep 13 13:05:29 2011
New Revision: 139612

URL: http://llvm.org/viewvc/llvm-project?rev=139612&view=rev
Log:
Add SplitEditor::markOverlappedComplement().

This function is used to flag values where the complement interval may
overlap other intervals.  Call it from overlapIntv, and use the flag to
fully recompute those live ranges in transferValues().

Modified:
    llvm/trunk/lib/CodeGen/SplitKit.cpp
    llvm/trunk/lib/CodeGen/SplitKit.h

Modified: llvm/trunk/lib/CodeGen/SplitKit.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SplitKit.cpp?rev=139612&r1=139611&r2=139612&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/SplitKit.cpp (original)
+++ llvm/trunk/lib/CodeGen/SplitKit.cpp Tue Sep 13 13:05:29 2011
@@ -317,6 +317,7 @@
   Edit = &LRE;
   SpillMode = SM;
   OpenIdx = 0;
+  OverlappedComplement.clear();
   RegAssign.clear();
   Values.clear();
 
@@ -391,6 +392,16 @@
   VNI = 0;
 }
 
+void SplitEditor::markOverlappedComplement(const VNInfo *ParentVNI) {
+  if (OverlappedComplement.insert(ParentVNI))
+    markComplexMapped(0, ParentVNI);
+}
+
+bool SplitEditor::needsRecompute(unsigned RegIdx, const VNInfo *ParentVNI) {
+  return (RegIdx == 0 && OverlappedComplement.count(ParentVNI)) ||
+    Edit->didRematerialize(ParentVNI);
+}
+
 VNInfo *SplitEditor::defFromParent(unsigned RegIdx,
                                    VNInfo *ParentVNI,
                                    SlotIndex UseIdx,
@@ -575,7 +586,7 @@
 
   // The complement interval will be extended as needed by LRCalc.extend().
   if (ParentVNI)
-    markComplexMapped(0, ParentVNI);
+    markOverlappedComplement(ParentVNI);
   DEBUG(dbgs() << "    overlapIntv [" << Start << ';' << End << "):");
   RegAssign.insert(Start, End, OpenIdx);
   DEBUG(dump());
@@ -623,7 +634,7 @@
 
       // Skip rematerialized values, we need to use LRCalc.extend() and
       // extendPHIKillRanges() to completely recompute the live ranges.
-      if (Edit->didRematerialize(ParentVNI)) {
+      if (needsRecompute(RegIdx, ParentVNI)) {
         DEBUG(dbgs() << "(remat)");
         Skipped = true;
         Start = End;

Modified: llvm/trunk/lib/CodeGen/SplitKit.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SplitKit.h?rev=139612&r1=139611&r2=139612&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/SplitKit.h (original)
+++ llvm/trunk/lib/CodeGen/SplitKit.h Tue Sep 13 13:05:29 2011
@@ -250,6 +250,10 @@
   /// The current spill mode, selected by reset().
   ComplementSpillMode SpillMode;
 
+  /// Parent interval values where the complement interval may be overlapping
+  /// other intervals.
+  SmallPtrSet<const VNInfo*, 8> OverlappedComplement;
+
   typedef IntervalMap<SlotIndex, unsigned> RegAssignMap;
 
   /// Allocator for the interval map. This will eventually be shared with
@@ -296,6 +300,17 @@
   /// of the number of defs.
   void markComplexMapped(unsigned RegIdx, const VNInfo *ParentVNI);
 
+  /// markOverlappedComplement - Mark ParentVNI as being overlapped in the
+  /// complement interval.  The complement interval may overlap other intervals
+  /// after overlapIntv has been called, or when in spill mode.
+  void markOverlappedComplement(const VNInfo *ParentVNI);
+
+  /// needsRecompute - Returns true if the live range of ParentVNI needs to be
+  /// recomputed in RegIdx using LiveRangeCalc::extend.  This is the case if
+  /// the value has been rematerialized, or when back-copies have been hoisted
+  /// in spill mode.
+  bool needsRecompute(unsigned RegIdx, const VNInfo *ParentVNI);
+
   /// defFromParent - Define Reg from ParentVNI at UseIdx using either
   /// rematerialization or a COPY from parent. Return the new value.
   VNInfo *defFromParent(unsigned RegIdx,





More information about the llvm-commits mailing list