@@ -163,14 +163,12 @@ namespace {
163
163
// / LaneMask are split as necessary. @p LaneMask are the lanes that
164
164
// / @p ToMerge will occupy in the coalescer register. @p LI has its subrange
165
165
// / lanemasks already adjusted to the coalesced register.
166
- // / @returns false if live range conflicts couldn't get resolved.
167
- bool mergeSubRangeInto (LiveInterval &LI, const LiveRange &ToMerge,
166
+ void mergeSubRangeInto (LiveInterval &LI, const LiveRange &ToMerge,
168
167
LaneBitmask LaneMask, CoalescerPair &CP);
169
168
170
169
// / Join the liveranges of two subregisters. Joins @p RRange into
171
170
// / @p LRange, @p RRange may be invalid afterwards.
172
- // / @returns false if live range conflicts couldn't get resolved.
173
- bool joinSubRegRanges (LiveRange &LRange, LiveRange &RRange,
171
+ void joinSubRegRanges (LiveRange &LRange, LiveRange &RRange,
174
172
LaneBitmask LaneMask, const CoalescerPair &CP);
175
173
176
174
// / We found a non-trivially-coalescable copy. If the source value number is
@@ -2469,7 +2467,7 @@ void JoinVals::eraseInstrs(SmallPtrSetImpl<MachineInstr*> &ErasedInstrs,
2469
2467
}
2470
2468
}
2471
2469
2472
- bool RegisterCoalescer::joinSubRegRanges (LiveRange &LRange, LiveRange &RRange,
2470
+ void RegisterCoalescer::joinSubRegRanges (LiveRange &LRange, LiveRange &RRange,
2473
2471
LaneBitmask LaneMask,
2474
2472
const CoalescerPair &CP) {
2475
2473
SmallVector<VNInfo*, 16 > NewVNInfo;
@@ -2484,13 +2482,15 @@ bool RegisterCoalescer::joinSubRegRanges(LiveRange &LRange, LiveRange &RRange,
2484
2482
// ranges get mapped to the "overflow" lane mask bit which creates unexpected
2485
2483
// interferences.
2486
2484
if (!LHSVals.mapValues (RHSVals) || !RHSVals.mapValues (LHSVals)) {
2487
- DEBUG (dbgs () << " *** Couldn't join subrange!\n " );
2488
- return false ;
2485
+ // We already determined that it is legal to merge the intervals, so this
2486
+ // should never fail.
2487
+ llvm_unreachable (" *** Couldn't join subrange!\n " );
2489
2488
}
2490
2489
if (!LHSVals.resolveConflicts (RHSVals) ||
2491
2490
!RHSVals.resolveConflicts (LHSVals)) {
2492
- DEBUG (dbgs () << " *** Couldn't join subrange!\n " );
2493
- return false ;
2491
+ // We already determined that it is legal to merge the intervals, so this
2492
+ // should never fail.
2493
+ llvm_unreachable (" *** Couldn't join subrange!\n " );
2494
2494
}
2495
2495
2496
2496
// The merging algorithm in LiveInterval::join() can't handle conflicting
@@ -2513,17 +2513,16 @@ bool RegisterCoalescer::joinSubRegRanges(LiveRange &LRange, LiveRange &RRange,
2513
2513
2514
2514
DEBUG (dbgs () << " \t\t joined lanes: " << LRange << " \n " );
2515
2515
if (EndPoints.empty ())
2516
- return true ;
2516
+ return ;
2517
2517
2518
2518
// Recompute the parts of the live range we had to remove because of
2519
2519
// CR_Replace conflicts.
2520
2520
DEBUG (dbgs () << " \t\t restoring liveness to " << EndPoints.size ()
2521
2521
<< " points: " << LRange << ' \n ' );
2522
2522
LIS->extendToIndices (LRange, EndPoints);
2523
- return true ;
2524
2523
}
2525
2524
2526
- bool RegisterCoalescer::mergeSubRangeInto (LiveInterval &LI,
2525
+ void RegisterCoalescer::mergeSubRangeInto (LiveInterval &LI,
2527
2526
const LiveRange &ToMerge,
2528
2527
LaneBitmask LaneMask,
2529
2528
CoalescerPair &CP) {
@@ -2553,16 +2552,14 @@ bool RegisterCoalescer::mergeSubRangeInto(LiveInterval &LI,
2553
2552
CommonRange = &R;
2554
2553
}
2555
2554
LiveRange RangeCopy (ToMerge, Allocator);
2556
- if (!joinSubRegRanges (*CommonRange, RangeCopy, Common, CP))
2557
- return false ;
2555
+ joinSubRegRanges (*CommonRange, RangeCopy, Common, CP);
2558
2556
LaneMask &= ~RMask;
2559
2557
}
2560
2558
2561
2559
if (LaneMask != 0 ) {
2562
2560
DEBUG (dbgs () << " \t\t New Lane " << PrintLaneMask (LaneMask) << ' \n ' );
2563
2561
LI.createSubRangeFrom (Allocator, LaneMask, ToMerge);
2564
2562
}
2565
- return true ;
2566
2563
}
2567
2564
2568
2565
bool RegisterCoalescer::joinVirtRegs (CoalescerPair &CP) {
@@ -2613,41 +2610,21 @@ bool RegisterCoalescer::joinVirtRegs(CoalescerPair &CP) {
2613
2610
2614
2611
// Determine lanemasks of RHS in the coalesced register and merge subranges.
2615
2612
unsigned SrcIdx = CP.getSrcIdx ();
2616
- bool Abort = false ;
2617
2613
if (!RHS.hasSubRanges ()) {
2618
2614
LaneBitmask Mask = SrcIdx == 0 ? CP.getNewRC ()->getLaneMask ()
2619
2615
: TRI->getSubRegIndexLaneMask (SrcIdx);
2620
- if (!mergeSubRangeInto (LHS, RHS, Mask, CP))
2621
- Abort = true ;
2616
+ mergeSubRangeInto (LHS, RHS, Mask, CP);
2622
2617
} else {
2623
2618
// Pair up subranges and merge.
2624
2619
for (LiveInterval::SubRange &R : RHS.subranges ()) {
2625
2620
LaneBitmask Mask = TRI->composeSubRegIndexLaneMask (SrcIdx, R.LaneMask );
2626
- if (!mergeSubRangeInto (LHS, R, Mask, CP)) {
2627
- Abort = true ;
2628
- break ;
2629
- }
2621
+ mergeSubRangeInto (LHS, R, Mask, CP);
2630
2622
}
2631
2623
}
2632
- if (Abort) {
2633
- // This shouldn't have happened :-(
2634
- // However we are aware of at least one existing problem where we
2635
- // can't merge subranges when multiple ranges end up in the
2636
- // "overflow bit" 32. As a workaround we drop all subregister ranges
2637
- // which means we loose some precision but are back to a well defined
2638
- // state.
2639
- assert (TargetRegisterInfo::isImpreciseLaneMask (
2640
- CP.getNewRC ()->getLaneMask ())
2641
- && " SubRange merge should only fail when merging into bit 32." );
2642
- DEBUG (dbgs () << " \t Subrange join aborted!\n " );
2643
- LHS.clearSubRanges ();
2644
- RHS.clearSubRanges ();
2645
- } else {
2646
- DEBUG (dbgs () << " \t Joined SubRanges " << LHS << " \n " );
2624
+ DEBUG (dbgs () << " \t Joined SubRanges " << LHS << " \n " );
2647
2625
2648
- LHSVals.pruneSubRegValues (LHS, ShrinkMask);
2649
- RHSVals.pruneSubRegValues (LHS, ShrinkMask);
2650
- }
2626
+ LHSVals.pruneSubRegValues (LHS, ShrinkMask);
2627
+ RHSVals.pruneSubRegValues (LHS, ShrinkMask);
2651
2628
}
2652
2629
2653
2630
// The merging algorithm in LiveInterval::join() can't handle conflicting
0 commit comments