Merging r260164:
[oota-llvm.git] / lib / CodeGen / CalcSpillWeights.cpp
index abc655ac34ca0a36c891e768957bf0bd9ab58272..26aa46fb6c2afd8eec96ded3d86d1b3b47b3be26 100644 (file)
@@ -213,8 +213,11 @@ VirtRegAuxInfo::calculateSpillWeightAndHint(LiveInterval &li) {
   if (!Spillable)
     return;
 
   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;
   }
     li.markNotSpillable();
     return;
   }