@@ -2456,7 +2456,6 @@ class BoUpSLP {
2456
2456
NextLoadStore = nullptr ;
2457
2457
IsScheduled = false ;
2458
2458
SchedulingRegionID = BlockSchedulingRegionID;
2459
- UnscheduledDepsInBundle = UnscheduledDeps;
2460
2459
clearDependencies ();
2461
2460
OpValue = OpVal;
2462
2461
TE = nullptr ;
@@ -2467,8 +2466,8 @@ class BoUpSLP {
2467
2466
void verify () {
2468
2467
if (hasValidDependencies ()) {
2469
2468
assert (UnscheduledDeps <= Dependencies && " invariant" );
2470
- assert (UnscheduledDeps <= FirstInBundle-> UnscheduledDepsInBundle &&
2471
- " bundle must have at least as many dependencies as member " );
2469
+ } else {
2470
+ assert (UnscheduledDeps == Dependencies && " invariant " );
2472
2471
}
2473
2472
2474
2473
if (IsScheduled) {
@@ -2479,6 +2478,8 @@ class BoUpSLP {
2479
2478
}
2480
2479
2481
2480
// / Returns true if the dependency information has been calculated.
2481
+ // / Note that depenendency validity can vary between instructions within
2482
+ // / a single bundle.
2482
2483
bool hasValidDependencies () const { return Dependencies != InvalidDeps; }
2483
2484
2484
2485
// / Returns true for single instructions and for bundle representatives
@@ -2496,20 +2497,23 @@ class BoUpSLP {
2496
2497
bool isReady () const {
2497
2498
assert (isSchedulingEntity () &&
2498
2499
" can't consider non-scheduling entity for ready list" );
2499
- return UnscheduledDepsInBundle == 0 && !IsScheduled;
2500
+ return unscheduledDepsInBundle () == 0 && !IsScheduled;
2500
2501
}
2501
2502
2502
- // / Modifies the number of unscheduled dependencies, also updating it for
2503
- // / the whole bundle.
2503
+ // / Modifies the number of unscheduled dependencies for this instruction,
2504
+ // / and returns the number of remaining dependencies for the containing
2505
+ // / bundle.
2504
2506
int incrementUnscheduledDeps (int Incr) {
2507
+ assert (hasValidDependencies () &&
2508
+ " increment of unscheduled deps would be meaningless" );
2505
2509
UnscheduledDeps += Incr;
2506
- return FirstInBundle->UnscheduledDepsInBundle += Incr ;
2510
+ return FirstInBundle->unscheduledDepsInBundle () ;
2507
2511
}
2508
2512
2509
2513
// / Sets the number of unscheduled dependencies to the number of
2510
2514
// / dependencies.
2511
2515
void resetUnscheduledDeps () {
2512
- incrementUnscheduledDeps (Dependencies - UnscheduledDeps) ;
2516
+ UnscheduledDeps = Dependencies ;
2513
2517
}
2514
2518
2515
2519
// / Clears all dependency information.
@@ -2519,6 +2523,18 @@ class BoUpSLP {
2519
2523
MemoryDependencies.clear ();
2520
2524
}
2521
2525
2526
+ int unscheduledDepsInBundle () const {
2527
+ assert (isSchedulingEntity () && " only meaningful on the bundle" );
2528
+ int Sum = 0 ;
2529
+ for (const ScheduleData *BundleMember = this ; BundleMember;
2530
+ BundleMember = BundleMember->NextInBundle ) {
2531
+ if (BundleMember->UnscheduledDeps == InvalidDeps)
2532
+ return InvalidDeps;
2533
+ Sum += BundleMember->UnscheduledDeps ;
2534
+ }
2535
+ return Sum;
2536
+ }
2537
+
2522
2538
void dump (raw_ostream &os) const {
2523
2539
if (!isSchedulingEntity ()) {
2524
2540
os << " / " << *Inst;
@@ -2572,10 +2588,6 @@ class BoUpSLP {
2572
2588
// / Note that this is negative as long as Dependencies is not calculated.
2573
2589
int UnscheduledDeps = InvalidDeps;
2574
2590
2575
- // / The sum of UnscheduledDeps in a bundle. Equals to UnscheduledDeps for
2576
- // / single instructions.
2577
- int UnscheduledDepsInBundle = InvalidDeps;
2578
-
2579
2591
// / True if this instruction is scheduled (or considered as scheduled in the
2580
2592
// / dry-run).
2581
2593
bool IsScheduled = false ;
@@ -7503,8 +7515,6 @@ BoUpSLP::BlockScheduling::buildBundle(ArrayRef<Value *> VL) {
7503
7515
} else {
7504
7516
Bundle = BundleMember;
7505
7517
}
7506
- BundleMember->UnscheduledDepsInBundle = 0 ;
7507
- Bundle->UnscheduledDepsInBundle += BundleMember->UnscheduledDeps ;
7508
7518
7509
7519
// Group the instructions to a bundle.
7510
7520
BundleMember->FirstInBundle = Bundle;
@@ -7631,8 +7641,7 @@ void BoUpSLP::BlockScheduling::cancelScheduling(ArrayRef<Value *> VL,
7631
7641
BundleMember->FirstInBundle = BundleMember;
7632
7642
ScheduleData *Next = BundleMember->NextInBundle ;
7633
7643
BundleMember->NextInBundle = nullptr ;
7634
- BundleMember->UnscheduledDepsInBundle = BundleMember->UnscheduledDeps ;
7635
- if (BundleMember->UnscheduledDepsInBundle == 0 ) {
7644
+ if (BundleMember->unscheduledDepsInBundle () == 0 ) {
7636
7645
ReadyInsts.insert (BundleMember);
7637
7646
}
7638
7647
BundleMember = Next;
0 commit comments