@@ -299,7 +299,7 @@ bool MemoryLocations::analyzeAddrProjection(
299
299
subLocationMap)) {
300
300
return false ;
301
301
}
302
- addr2LocIdx[ projection] = subLocIdx;
302
+ registerProjection ( projection, subLocIdx) ;
303
303
collectedVals.push_back (projection);
304
304
return true ;
305
305
}
@@ -395,7 +395,7 @@ void MemoryDataflow::exitReachableAnalysis() {
395
395
}
396
396
}
397
397
398
- void MemoryDataflow::solveDataflowForward ( ) {
398
+ void MemoryDataflow::solveForward (JoinOperation join ) {
399
399
// Pretty standard data flow solving.
400
400
bool changed = false ;
401
401
bool firstRound = true ;
@@ -405,7 +405,7 @@ void MemoryDataflow::solveDataflowForward() {
405
405
Bits bits = st.entrySet ;
406
406
assert (!bits.empty ());
407
407
for (SILBasicBlock *pred : st.block ->getPredecessorBlocks ()) {
408
- bits &= block2State[pred]->exitSet ;
408
+ join ( bits, block2State[pred]->exitSet ) ;
409
409
}
410
410
if (firstRound || bits != st.entrySet ) {
411
411
changed = true ;
@@ -419,7 +419,19 @@ void MemoryDataflow::solveDataflowForward() {
419
419
} while (changed);
420
420
}
421
421
422
- void MemoryDataflow::solveDataflowBackward () {
422
+ void MemoryDataflow::solveForwardWithIntersect () {
423
+ solveForward ([](Bits &entry, const Bits &predExit){
424
+ entry &= predExit;
425
+ });
426
+ }
427
+
428
+ void MemoryDataflow::solveForwardWithUnion () {
429
+ solveForward ([](Bits &entry, const Bits &predExit){
430
+ entry |= predExit;
431
+ });
432
+ }
433
+
434
+ void MemoryDataflow::solveBackward (JoinOperation join) {
423
435
// Pretty standard data flow solving.
424
436
bool changed = false ;
425
437
bool firstRound = true ;
@@ -429,7 +441,7 @@ void MemoryDataflow::solveDataflowBackward() {
429
441
Bits bits = st.exitSet ;
430
442
assert (!bits.empty ());
431
443
for (SILBasicBlock *succ : st.block ->getSuccessorBlocks ()) {
432
- bits &= block2State[succ]->entrySet ;
444
+ join ( bits, block2State[succ]->entrySet ) ;
433
445
}
434
446
if (firstRound || bits != st.exitSet ) {
435
447
changed = true ;
@@ -443,6 +455,18 @@ void MemoryDataflow::solveDataflowBackward() {
443
455
} while (changed);
444
456
}
445
457
458
+ void MemoryDataflow::solveBackwardWithIntersect () {
459
+ solveBackward ([](Bits &entry, const Bits &predExit){
460
+ entry &= predExit;
461
+ });
462
+ }
463
+
464
+ void MemoryDataflow::solveBackwardWithUnion () {
465
+ solveBackward ([](Bits &entry, const Bits &predExit){
466
+ entry |= predExit;
467
+ });
468
+ }
469
+
446
470
void MemoryDataflow::dump () const {
447
471
for (const BlockState &st : blockStates) {
448
472
llvm::dbgs () << " bb" << st.block ->getDebugID () << " :\n "
@@ -894,7 +918,7 @@ void MemoryLifetimeVerifier::verify() {
894
918
MemoryDataflow dataFlow (function, locations.getNumLocations ());
895
919
dataFlow.entryReachabilityAnalysis ();
896
920
initDataflow (dataFlow);
897
- dataFlow.solveDataflowForward ();
921
+ dataFlow.solveForwardWithIntersect ();
898
922
checkFunction (dataFlow);
899
923
}
900
924
// Second step: handle single-block locations.
0 commit comments