[llvm-branch-commits] [llvm-branch] r261125 - Merging r260164:

David Majnemer via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Wed Feb 17 10:41:45 PST 2016


Author: majnemer
Date: Wed Feb 17 12:41:44 2016
New Revision: 261125

URL: http://llvm.org/viewvc/llvm-project?rev=261125&view=rev
Log:
Merging r260164:
------------------------------------------------------------------------
r260164 | akaylor | 2016-02-08 14:52:51 -0800 (Mon, 08 Feb 2016) | 5 lines

[regalloc][WinEH] Do not mark intervals as not spillable if they contain a regmask

Differential Revision: http://reviews.llvm.org/D16831


------------------------------------------------------------------------

Added:
    llvm/branches/release_38/test/CodeGen/X86/regalloc-spill-at-ehpad.ll
      - copied unchanged from r260164, llvm/trunk/test/CodeGen/X86/regalloc-spill-at-ehpad.ll
Modified:
    llvm/branches/release_38/   (props changed)
    llvm/branches/release_38/include/llvm/CodeGen/LiveInterval.h
    llvm/branches/release_38/lib/CodeGen/CalcSpillWeights.cpp
    llvm/branches/release_38/lib/CodeGen/LiveInterval.cpp

Propchange: llvm/branches/release_38/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Wed Feb 17 12:41:44 2016
@@ -1,3 +1,3 @@
 /llvm/branches/Apple/Pertwee:110850,110961
 /llvm/branches/type-system-rewrite:133420-134817
-/llvm/trunk:155241,257645,257648,257730,257775,257791,257864,257875,257886,257902,257905,257925,257929-257930,257940,257942,257977,257979,257997,258103,258112,258168,258184,258207,258221,258273,258325,258406,258416,258428,258436,258471,258690,258729,258891,258971,259177-259178,259228,259236,259342,259346,259375,259381,259645,259649,259695-259696,259740,259798,259835,259840,259886,259888,259958,260390,260427,260587,260641,260703,260733,261033
+/llvm/trunk:155241,257645,257648,257730,257775,257791,257864,257875,257886,257902,257905,257925,257929-257930,257940,257942,257977,257979,257997,258103,258112,258168,258184,258207,258221,258273,258325,258406,258416,258428,258436,258471,258690,258729,258891,258971,259177-259178,259228,259236,259342,259346,259375,259381,259645,259649,259695-259696,259740,259798,259835,259840,259886,259888,259958,260164,260390,260427,260587,260641,260703,260733,261033

Modified: llvm/branches/release_38/include/llvm/CodeGen/LiveInterval.h
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/release_38/include/llvm/CodeGen/LiveInterval.h?rev=261125&r1=261124&r2=261125&view=diff
==============================================================================
--- llvm/branches/release_38/include/llvm/CodeGen/LiveInterval.h (original)
+++ llvm/branches/release_38/include/llvm/CodeGen/LiveInterval.h Wed Feb 17 12:41:44 2016
@@ -544,6 +544,11 @@ namespace llvm {
       return true;
     }
 
+    // Returns true if any segment in the live range contains any of the
+    // provided slot indexes.  Slots which occur in holes between
+    // segments will not cause the function to return true.
+    bool isLiveAtIndexes(ArrayRef<SlotIndex> Slots) const;
+
     bool operator<(const LiveRange& other) const {
       const SlotIndex &thisIndex = beginIndex();
       const SlotIndex &otherIndex = other.beginIndex();

Modified: llvm/branches/release_38/lib/CodeGen/CalcSpillWeights.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/release_38/lib/CodeGen/CalcSpillWeights.cpp?rev=261125&r1=261124&r2=261125&view=diff
==============================================================================
--- llvm/branches/release_38/lib/CodeGen/CalcSpillWeights.cpp (original)
+++ llvm/branches/release_38/lib/CodeGen/CalcSpillWeights.cpp Wed Feb 17 12:41:44 2016
@@ -213,8 +213,11 @@ VirtRegAuxInfo::calculateSpillWeightAndH
   if (!Spillable)
     return;
 
-  // Mark li as unspillable if all live ranges are tiny.
-  if (li.isZeroLength(LIS.getSlotIndexes())) {
+  // Mark li as unspillable if all live ranges are tiny and the interval
+  // is not live at any reg mask.  If the interval is live at a reg mask
+  // spilling may be required.
+  if (li.isZeroLength(LIS.getSlotIndexes()) &&
+      !li.isLiveAtIndexes(LIS.getRegMaskSlots())) {
     li.markNotSpillable();
     return;
   }

Modified: llvm/branches/release_38/lib/CodeGen/LiveInterval.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/release_38/lib/CodeGen/LiveInterval.cpp?rev=261125&r1=261124&r2=261125&view=diff
==============================================================================
--- llvm/branches/release_38/lib/CodeGen/LiveInterval.cpp (original)
+++ llvm/branches/release_38/lib/CodeGen/LiveInterval.cpp Wed Feb 17 12:41:44 2016
@@ -748,6 +748,40 @@ void LiveRange::flushSegmentSet() {
   verify();
 }
 
+bool LiveRange::isLiveAtIndexes(ArrayRef<SlotIndex> Slots) const {
+  ArrayRef<SlotIndex>::iterator SlotI = Slots.begin();
+  ArrayRef<SlotIndex>::iterator SlotE = Slots.end();
+
+  // If there are no regmask slots, we have nothing to search.
+  if (SlotI == SlotE)
+    return false;
+
+  // Start our search at the first segment that ends after the first slot.
+  const_iterator SegmentI = find(*SlotI);
+  const_iterator SegmentE = end();
+
+  // If there are no segments that end after the first slot, we're done.
+  if (SegmentI == SegmentE)
+    return false;
+
+  // Look for each slot in the live range.
+  for ( ; SlotI != SlotE; ++SlotI) {
+    // Go to the next segment that ends after the current slot.
+    // The slot may be within a hole in the range.
+    SegmentI = advanceTo(SegmentI, *SlotI);
+    if (SegmentI == SegmentE)
+      return false;
+
+    // If this segment contains the slot, we're done.
+    if (SegmentI->contains(*SlotI))
+      return true;
+    // Otherwise, look for the next slot.
+  }
+
+  // We didn't find a segment containing any of the slots.
+  return false;
+}
+
 void LiveInterval::freeSubRange(SubRange *S) {
   S->~SubRange();
   // Memory was allocated with BumpPtr allocator and is not freed here.




More information about the llvm-branch-commits mailing list